I am not telling about the history of C/C++ language.Programming Is nothing But Just a line of Code in Computer Language, as we Speak Multi language's same our system has its own Language like C, C++, and Java.You have to know that our Computer Know's Only '0' (Zero) And '1' (One), one more thing I want to share with you in programming HELLO WORLD! is a very famous program but I am not going to start with Hello World. For compiling your code we need a compiler there are many compilers like Borland, Dev-C++, Turbo C, Code Blocks you can use anyone of them My favorite is Dev C++ cause it is fast and simple in use.But I think Codeblocks Is Better.I recommend Dev-C++ for beginner's And for Expert CodeBlocks
For Downloading DEV-C++ Click Here
using namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a+b; //store sum in c
cout<<"sum is = "<<c<<endl; //print sum
return 0;
}
using namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a-b; //store sum in c
cout<<"subtraction is = "<<c<<endl; //print sum
return 0;
}
using namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a*b; //store sum in c
cout<<"multiple is = "<<c<<endl; //print sum
return 0;
}
using namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a/b; //store sum in c
cout<<"devision is = "<<c<<endl; //print sum
return 0;
}
using namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a%b; //store sum in c
cout<<"modulus is = "<<c<<endl; //print sum
return 0;
}
using namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=(a+b)/2; //store sum in c
cout<<"avg is = "<<c<<endl; //print sum
return 0;
}
For Downloading DEV-C++ Click Here
Your First Step To Analysis The Following Code and Write And Modify By Own. Below are some basic program in C++ for understanding a syntax of C++
1. C++ Program To Add Two Number
#include<iostream> //header file for input outputusing namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a+b; //store sum in c
cout<<"sum is = "<<c<<endl; //print sum
return 0;
}
2. C++ Program To Subtract Two Number
#include<iostream> //header file for input outputusing namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a-b; //store sum in c
cout<<"subtraction is = "<<c<<endl; //print sum
return 0;
}
3. C++ Program To Multiply Two Number
#include<iostream> //header file for input outputusing namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a*b; //store sum in c
cout<<"multiple is = "<<c<<endl; //print sum
return 0;
}
4. C++ Program To Divide Two Number
#include<iostream> //header file for input outputusing namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a/b; //store sum in c
cout<<"devision is = "<<c<<endl; //print sum
return 0;
}
5. C++ Program To Find Modulus (Reminder) Of Two Number
#include<iostream> //header file for input outputusing namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=a%b; //store sum in c
cout<<"modulus is = "<<c<<endl; //print sum
return 0;
}
6. C++ Program To Find Average Of Two Number
#include<iostream> //header file for input outputusing namespace std; // for initilize input output statement
int main() //starting a program
{
long a,b,c; // long is a data type you can use float,double,and int
cout<<"enter the two nuber :"<<endl;
cin>>a>>b; //enter value a nad then b
c=(a+b)/2; //store sum in c
cout<<"avg is = "<<c<<endl; //print sum
return 0;
}
Thanks for providing these programs, is turbo c++ ide good to code in c++ language or to just practice programs for beginners.
ReplyDelete