วันศุกร์ที่ 18 กันยายน พ.ศ. 2552

unit 2

#include
#include
#include
#include
void main()
{
int ch2;
do
{
clrscr();
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"************************************\n"<cout<<" Unit 2 "<cout<<" [1] Cout_exp.CPP "<cout<<" [2] Cout_exp2.CPP "<cout<<" [3] Endl_exp.CPP "<cout<<" [4] Setw.CPP "<cout<<" [5] Coutmat.CPP "<cout<<" [6] Set_dec.CPP "<cout<<" [7] Func_Mat.CPP "<cout<<" [8] Escape.CPP "<cout<<" [9] Area_cir.CPP "<cout<<" [10] Cin_cont.CPP "<cout<<" [11] Base_mun.CPP "<cout<<" [0] Back To Manu \n"<cout<<"************************************"<cout<<"\nPlease Select [0-11] : ";
cin>>ch2;
switch(ch2)
{
case 1 :
clrscr();
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"This is Turbo C++Program";
cout<<"C++ is hight language";
getch();
break;
case 2 :
clrscr();
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"This is Turbo C++Program."<<" "<<" It is very easy.";
cout<<"I love C++."<<" "<<" It's high level language.";
getch();
break;
case 3 :
clrscr(); //clear screen standard function form conio.h
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"This is Turbo C++Progarm"<cout<<"It is very easy."<cout<cout<<"I like C++Program"<cout<<"Press any key to continue..."<getch(); //get character standard function form conio.h
break;
case 4 :
clrscr(); //clear screen standard function form conio.h
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<cout<cout<cout<cout<getch(); //get character standara function form conio.h
break;
case 5 :
int number4,number5;
float x4,y4,z4 ;
//set value of variable
number4=20;
number5=30;
x4=25.25;y4=30.05;z4=10.75;
//display calculation result
clrscr();
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"Program Display Mathmetic calculation"<cout<<"\n";
cout<<"number1="<cout<<"\n";
cout<<"number2="<cout<<"\n";
cout<<"number1+number2="<cout<<"\n";
cout<<"number1-number2="<cout<<"\n";
cout<<"x+y+z="<cout<<"\n";
cout<<"x*y*z="<cout<<"\n";
cout<<"50*25*12.5="<<50*25*12.5<getch();
break;
case 6 :
float A5=125.25125;
float B5=10.7525;
float C5=212.15;
clrscr(); //function in conio.h for clear screen
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"Display set precision of float number..."<cout<<"\n";
cout<<"A+B+"<cout<<"\n";
cout<<"A*B*C="<cout<<"\n";
cout<<"A*B="<cout<<"\n";
cout<<"A+B+C="<cout<<"\n";
cout<<"A+B+C="<cout<<"\n";
cout<<"A/B="<getch();
break;
case 7 :
double x6=9.0 ,y6=2.0;
clrscr();
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"Display useing mathmetic functions...\a"<cout<getch();
break;
case 8 :
clrscr();//clear screen
int number6,ch6,number7;
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<" No : 11\n";
cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"Hello Program C++"<<'\n';//new line
cin>>number6; //enter inter from keyboard
cout<<"\nEnter 1 character :";
cin>>ch6;//enter 1 character from keyboard
cout<<"\n\nPress any key to display...";
getch();//wait press any key
clrscr();
//Program display value from variable
cout<<"You enter number and character :\n\a";
cout<<"Value of number 1 :"<cout<<"\nValue of number 2 :"<cout<<"\nValue of character :"<cout<<"\n\nPress any key to exit..." ;
getch();
break;
case 9 :
float rad; //declared real variable
const float PI= 3.14159; // defined constant PI
//start statement
clrscr();
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<< "Please enter radius of circle : ";
cin>>rad;
float area = PI*rad*rad;//declarad variable at position that want to use
cout<<"\n\nRadius of circle = "<cout<<"\n\nArea of circles = \a\n"<getch();
break;
case 10 :
int numbera,numberb,numberc;//declared 3 integer variable
//start startment
clrscr();
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<" Please enter 3 integer number :\n ";
cin>> numbera,numberb,numberc;//enter 3 amount integer from keyboard
cout<<"\nPress any key to display.... " ;
getch();
clrscr();
//process display value from variable
cout<<"You enter 3 number: \n\a";
cout<<"Value of number1 :\n"<cout<<"Value of number2: \n"<cout<<"Value of number3 :\n"<cout<<"Press any key to exit...\n" ;
getch();//wait press any key
break;
case 11 :
clrscr();
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"\n";
cout<<"+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n";
cout<<"\n";
cout<< "Display change base number ..."<cout<<"\n";
cout<< "10 decimal to hexadecimal = "<cout<<"\n";
cout<< "5865 decimal to hexadecimal = " <cout<<"\n";
cout<< "1250 decimal to octal = "<cout<<"\n";
cout<< "02342 octal to decimal = "<cout<<"\n";
cout<< "0xabc 125 hexadecimal to decimal = "<cout<<"\n";
cout<< "0xf hexadecimal to decimal = "<getch();
break;
}//end of do...while
}//end of switch
while(ch2!=0);
getch();
}


ไม่มีความคิดเห็น:

แสดงความคิดเห็น