You are on page 1of 6

 C++ sting variable : ami jodi onk ghulo carecter nite chai tahole char e number ba koyta

character add hbe ta ta r number didte hbe example: { char name [13] = “anisur Rahman ” ;

 Get user input

#include <iostream>
#include <conio.h>
using namespace std ;

int main ()
{

int num; ---------------------------------------------- for getting character in and ouput use


char ch;
cout << "enter an integer number";
cin>>num;
cout<< "enter number is"<< num ;
getch () ;

}
2.{
int num1,num2,sum;
cout<< "enter two number";
cin>> num1>>num2; for user input two value
sum = num1 +num2;
cout<< sum;

getch () ;

3#

int num1,num2;
num1=20;
num2=30;
int sum = num1+num2;
cout<<"sum is = "<<sum<<endl;

int sub = num1 - num2;


cout<<"substraction is = "<<sub<<endl;

int mal = num1 * num2;


cout<<"multipication is = "<<mal<<endl;
double div = (float)num1 / num2; ( // DOHOMIC er por ER NUMBER SHOW
KORANOR JNNO 'INT' ER JAYGAY
'DOUBLE'USE AND JEI KONO
EKTA KE FLOT SHOW KRTE HBE//)
cout<<"division is = "<<div<<endl;

int rem = num1 % num2;


cout<<"reminder is = "<<rem<<endl;

4.
{
float num1,num2; // float use kora hoyeche point number show koranr jnnno //
cout<<"enter two number = "<<endl;
cin>>num1>>num2;
cout<<showpoint; // point show korar jnno//
cout<<fixed; //
cout<< setprecision(3); /* joto number likha hbe output e result toto number e asbe point er ahge
and popint er por soho but ahge fixed use
korle than joto sonkha likha hbe toto sonkha point er por dekhabe*/

float sum = num1+num2;


cout<<setw(25)<<"sum is = "<<sum<<endl; // setw dea output show korar somoy out output er ahge
koto space nibe ta set korar jnno//

cout<<noshowpoint;
float sub = num1 - num2;
cout<<setw(25)<<"substraction is = "<<sub<<endl;

float mal = num1 * num2;


cout<<setw(25)<<"multipication is = "<<mal<<endl;

double div = (float)num1 / num2; // DOHOMIC er por ER NUMBER SHOW KORANOR JNNO 'INT' ER
JAYGAY 'DOUBLE'USE AND JEI KONO EKTA KE FLOT SHOW KRTE HBE//
cout<<setw(25)<<"division is = "<<div<<endl;

/*float rem = num1 % num2; // FLOAT E REMINDER BER KORA JAY NA //


cout<<"reminder is = "<<rem<<endl;*/

getch () ;

}
5. for find out triangle area
{
double base,height,area;
cout<<"enter base";
cin>>base;

cout<<"enter height";
cin>>height;

area = 0.5 * base * height ;

cout<< "area of triangle = " <<area;

getch () ;

6. area of circle

{
double pi,radious,area;
pi = 3.1416;

cout<<"enter radious";
cin>>radious;
area=pi*radious*radious;
cout<<"area of circle is " << area;

getch () ;

7.celcious to farhenhite

{
double farn,cels;
cout<< "enter celcious";
cin>>cels;
farn=1.8*cels+32; // for another jut put the right sue//
cout<<"Fahrenheite = "<<farn;

getch () ;

}
8. assignment operator

{
int x=3;
int y=2;
x+=y; //x=x+y//
cout<<x<<endl;

x-=y; //x=x-y//
cout<<x;

getch () ;

9. unary operator

{
int x=6;
int result = -x; // minus value output hisebe dekkhanor jnno//

cout<<result<<endl;
int x1=3;
--x1; // decriment: ahge bosano hoyeche 2 ta -- so output er ahge -1 hbe //

cout<<x1<<endl;

x1=++x1; // incriment = ahge bosano hoyeche 2 ta ++ so output er ahge +1 hbe //


cout<<x1<<endl ;

getch ();

10. bitwise operator


{
int a=32;
int b=12;
int c;

c = a&b; // bitwise and//


cout<<c<<endl;

c = a|b; //bitwise or//


cout<<c<<endl;

c = a^b; //exor//
cout<<c<<endl;

c = a>>3; //shift right----> right shift hole 2 kor vag hbe //


cout<<c<<endl;

c = a<<3; //shift left----------> left shift hole 2 kore gun hbe//


cout<<c<<endl;

getch () ;

}
11. apecial operator
{
int a;
float f;
double d;
char ch ;
char name [20];

int c = sizeof(name); // koto size ba space nische show korbe//


cout<<c<<endl;

getch () ;

12.if statement
{
int num;
cout<<"enter any integer number :";
cin>>num;
if(num>0)
cout<<"positive"<<endl;
if(num<0)
cout<<"negative"<<endl;
if(num==0)
cout<<"zero"<<endl;

getch () ;

13.if else
{
int num;
cout<<"enter any integer number :";
cin>>num;
if(num>0){
cout<<"positive"<<endl;
}
else if(num<0) {
cout<<"negative"<<endl;
}
else // else e kono condition hbe na//
{
cout<<"zero"<<endl;
}

getch () ;

You might also like