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

unit 5

#include
#include
#include
#include
float sum57(float arg1,float arg2);
float multiply57(float&arg3,float&arg4);
float arg1,arg2,arg3,arg4 ;
void line58();
void line58(int x58);
void line58(char ch58,int x58);
void line58(char ch58);
void line59(char ch59='_',int x59=80);
void line510();
void repeat510();
int x510;
int y510;
template
TYPE sum511(TYPE first,TYPE second)
{
return first+second;
}
template
New_type multiply511(New_type number511,New_type number512)
{
return number511*number512;
}
void main()
{
int ch5;
do
{
clrscr();
cout<<"\n Program By : pratya wutticho "<cout<<" No : 8 "<cout<<"************************************\n"<cout<<" Unit 5 "<cout<<" [1] Line_non "<cout<<" [2] Func_non "<cout<<" [3] Line_par "<cout<<" [4] Func_par "<cout<<" [5] Non_prot "<cout<<" [6] Inline "<cout<<" [7] Argument "<cout<<" [8] Over_fun "<cout<<" [9] Default "<cout<<" [10] Type_var "<cout<<" [11] Template "<cout<<" [0] Back To Manu \n "<cout<<"************************************"<cout<<"\nPlease Select [0-11] : ";
cin>>ch5;
switch(ch5)
{
case 1:
int i51;
clrscr();
cout<<"Display l line from iine() function\n";
cout<<"____________________________\n";
getch();
cout<<"Display 5 lines from line () function\n";
for (i51=1;i51<=5;++i51)
cout<<"____________________________\n";
getch();
break;

case 2:
int summation52();
int x52,y52;
clrscr();
int result52;
cout<<"Enter 2 number for summation:"<cout<<"Number1 :";cin>>x52;
cout<<"Number2 :";cin>>y52;
result52=x52+y52;
cout<<"Result of x+y=\a" <getch();
break;

case 3:
int amount53,i53=45;
clrscr();
cout<<"Display line from line () function \n";
amount53=30;
int x53,y53,z53;
for(x53=1;x53<=amount53;++x53)
cout<<"_";
cout<<'\n';
getch();
amount53=50;
for(y53=1;y53<=amount53;++y53)
cout<<"_";
cout<<'\n';
getch();
amount53=i53;
for(z53=1;z53<=amount53;++z53)
cout<<"_";
cout<<'\n';
getch();
break;

case 4:
float addition54;
float subtract54;
float multiply54;
float divide54;
float x54,y54;
clrscr();
cout<<"Enter 2 number for calculate:"<cout<<"Number1 :",cin>>x54;
cout<<"Number2 :",cin>>y54;
addition54=x54+y54;
subtract54=x54-y54;
multiply54=x54*y54;
divide54=x54/y54;
cout<<"Result of addition="<cout<<"Result of subtract="<cout<<"Result of multiply="<cout<<"Result of subtract="<getch();
cout<<"Calculate by sent argument to parameters of function .."<getch();
addition54=120.0+20.25;
subtract54=120.0-20.25;
multiply54=120.0*20.25;
divide54=120.0/20.25;
cout<<"Result of 10.0+20.25="<cout<<"Result of 10.0-20.25="<cout<<"Result of 10.0*20.25="<cout<<"Result of 10.0/20.25="<getch();
break;

case 5:
cout<<"_";
cout<<'\n';
clrscr();
cout<<"Display line from line1() function \n";
cout<<"________________________________________\n";
getch();
cout<<"\nDisplay line from line2() function\n";
cout<<"**********************\n" ;
cout<<"________________________________________";
getch();
break;

case 6:
int number56;
clrscr();
cout<<"Enter number to calculate square: ";
cin>>number56;
cout<<"Result of square ="<getch();
break;

case 7:
clrscr();
cout<<"Please enter 4 number for argument :\n";
cout<<"Argument1 :";cin>>arg1;
cout<<"Argument2 :";cin>>arg2;
cout<<"Argument3 :";cin>>arg3;
cout<<"Argument4 :";cin>>arg4;
cout<<"\n\n Display call function sum() and send value arument";
cout<<"\nValue argument before send to function:";
cout<<"\nArgument 1="<cout<<"\nArgument 1="<cout<<"\nValue argument before send to function:";
cout<<"\nArgument 3="<cout<<"\nArgument 3="<line58();
cout<<"Display 2 line from line()function\n";
line58(30);
cout<<"Display 3 line from line()function\n";
line58('*',60);
cout<<"Display 4 line from line()function\n";
line58('+');
getch();
break;

case 9:
clrscr();
cout<<"Display line from line() function\n";
line59();
line59('+');
line59('#',50);
line59(65);
getch();
break;

case 10:
clrscr();
line510();
repeat510();
for(y510=1;y510<=5;++y510)
line510();
for(x510=1;x510<=5;++x510)
repeat510();
getch();
break;

case 11:
int x511=50,y511=30;
float a511=300.25,b511=100.50;
double c511=3.21541005,d511=10005.02541152;
clrscr();
cout<<"Sum interger"<cout<<"Sum float"<cout<<"Sum double"<cout<<"\n Multiply interger"<cout<<" Multiply float"<cout<<" Multiply double"<< multiply511(c511,d511);
getch();
break;

}//end of do...while
}//end of switch
while(ch5!=0);
}
float sum57(float para1,float para2)
{
return para1+para2;
}
float multiply57(float&para3, float&para4)
{
para3++;
para4++;
return para3*para4 ;
}

void line58()
{
cout<<"======================\n";
}
void line58(int x58)
{int y58;
for(y58=1;y58<=x58;++y58)
cout<<"_";
cout<<'\n';
}
void line58(char ch58,int x58)
{int y58;
for(y58=1;y58<=x58;++y58)
cout<cout<<'\n';
}
void line58(char ch58)
{int y58;
for(y58=1;y58<=80;++y58)
cout<cout<<'\n';
}

void line59(char ch59,int x59)
{
for(int y59=1;y59<=x59;++y59)
cout<cout<<'\n';
}

void line510()
{for(x510=1;x510<=80;x510++)
cout<<'=';
cout<}
void repeat510()
{int y510;
for(y510=1;y510<=40;++y510)
cout<<'#';
cout<}

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

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