Skip to main content

Arithm

/* c++ is world popular language you can do every thing with the help of this
but after learning it
today  lecture is on making calcultor but its mini hahahha

c++ have some Arthmetic operator  like + ,- ,*, /, % today i will teach you how
to use these operator in c++*/
#include<iostream>
#include<conio.h>
using namespace std;
main()

{
int r;  // declaring variable of data type int

r=2;    // assigning values to that variable

int b;  //declaring another varaible ;

b=4;    // assigning value to that variable

int sum; // declaring another varaible to hold the sum of the two variables

sum=r+b;  // here i am adding these two variables

cout<<sum;  //here is output of sum variable
}
/* CONCEPT:

you are aware of assigning values to variable but here is another concept
 on line 21 i declare int sum on line 23 the addition of both r and b are assign
 to the sum and at the end sum is out put

 so here a single variable is holding a combination of two variable

 Practise:
 
  write a program to perform the arithmetic operation by using all the operator
  also print result of all these operation
  */

Comments

Popular posts from this blog

White space in PHP

White space in PHP : <html> <head> <title>My First PHP Page</title> </head> <body> <?php echo "Hello World!";                  /*As with HTML, whitespace is ignored between PHP statements.                                       This means it is OK to have one line of PHP code, then 20 lines of blank space                                       before the next line of PHP code. You can also press tab to indent your code and                                       the PHP interpreter will ignore those spaces as well. like from line 9 to line                                       15 its whitespace but php does not consider it as whitespace*/ echo "Hello World!"; ?> </body> </html>

Assign Values to Variables

#include<iostream>     // it is  a library used for display #include<conio.h>      // its is also a library used for input output statement using namespace std; main()                 // it is the start of you your programe its means form here you will                        // start the coding . .  comouter only understand this main                       { int a=3,b=5;      /* Now what is  int a=3, b=5; as you are now full aware of (int)                   and (variable) but this  is some thing difficult. .  wait a minute                   its not difficult.*/ cout<<a<<endl; cout<<b<<endl;      /* as i discussed before that cout is use for out put statement                        but what do you think what will be output. . */ } /* CONCEPT: here its called assignment of  integers to variables like a=3 mean 3 is assign to a so if we cout (a) it will give us 3 same for the b.. .  todays lecture is very easy so enjoy upto

basic syntax of c++

Basic syntax of c++  #include<iostream>     // it is  a library used for display #include<conio.h>      // its is also a library used for input output statement using namespace std; main()                 // it is the start of you your program its means form here you will                        // start the coding . .  computer only understand this main                       {                      // starting your program  from starting cout<<"here is my first program in c++ "; // cout mean show me . . . << mean the thing infront of this <<                                          // " is used to give a simple string and you should put this after                                          // finishing your line . . . . and this ; is use to finish your one                                          // statement. } /* when you are going to save your this program you should give his extension cpp */ put this program