C++ Data Types Part – 1
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
include<iostream>
using namespace std;
int main()
{
string name="Vivek";
system("cls");
cout<<a;
//cout<<name.length();
// unsigned short a;
// a=65535;
// a=a+1;
// system("cls");
// //cout<<sizeof(a);
// cout<<a;
return 0;
}Program 2
#include<iostream>
using namespace std;
int main()
{
int a,b;
system("cls");
cout<<"Enter two number";
cin>>a>>b;
cout<<"\nBefore Swaping: "<<a<<" "<<b; // a=50 b =20
a=a+b; // a=70
b=a-b; // b=50
a=a-b; //a=20
// c=a;
// a=b;
// b=c;
cout<<"\nAfter Swaping: "<<a<<" "<<b;
// cout<<"\nAddition is: "<<a+b;
// cout<<"\nSubtraction is: "<<a-b;
// cout<<"\nDivision is: "<<a*b;;
// cout<<"\nMultiplication is: "<<a/b;
return 0;
}Program 3
#include<iostream>
using namespace std;
int main()
{
system("cls");
float a,r;
const float PI=3.14f;
cout<<"Enter redious";
cin>>r;
a=PI*r*r;
cout<<"Area is :"<<a;
return 0;
}Program 4
// Marksheet program
#include<iostream>
using namespace std;
int main()
{
int h,e,m,c,total;
float per;
system("cls");
cout<<"\n Enter marks of hindi";
cin>>h;
cout<<"\n Enter marks of english";
cin>>e;
cout<<"\n Enter marks of maths";
cin>>m;
cout<<"\n Enter marks of computer";
cin>>c;
total=h+e+m+c;
per=(total/4.0);
cout<<"\n Total Marks: "<<total;
cout<<"\n Percentage: "<<per;
return 0;
}If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

