Tuesday, December 16, 2014

Simple Program in C++



Program 1

#include
#include
void main()
{
int a,b,c;
clrscr();
cout<<"Enter a\n";
cin>>a;
cout<<"Enter b\n";
cin>>b;
c=a+b;
cout<<"Answer c : "<
getch();
}

Output

Enter A
50
Enter B
Answer C: 70

Program 2

#include
#include
void main()
{
char name[10],address[30],quail[20],phone[10];
int age;
clrscr();
cout<<"Enter the name\n";
cin>>name;
cout<<"Enter the address\n";
cin>>address;
cout<<"Enter the qualification\n";
cin>>quail;
cout<<"Enter the age \n";
cin>>age;
cout<<"Enter the phone number\n";
cin>>phone;
cout<<"\n Name   : "<
cout<<"\nAddress          : "<
cout<<"\n Qualification : "<
cout<<"\n Age      : "<
cout<<"\n Phone Number        : "<
getch();
}

Output

Enter the name
Aruna
Enter the address
Mumbai
Enter the qualification
BSC
Enter the age
21
Enter the phone number
9856722235

Name                    : Aruna
Address                : Mumbai
Qualification        : BSC
Age                       : 21
Phone Number     : 9856722235

No comments:

Post a Comment