วันอังคารที่ 2 มิถุนายน พ.ศ. 2552

สรุป 03/06/2009

#include
#include

void main()
{
clrscr();
cout<<"------------------------------------------\n";
cout<<"by pratya wutticho \n";
cout<<"--------no.8--------\n";
cout<<"-------------------------------------------\n";
cout<<"Name : pratya\n";
cout<<"Surname : wutticho\n";
cout<<"Nickname: ham \n";
cout<<"Birthday: 9/11/1989\n";
cout<<"Age : 19\n";
cout<<"Address : 98 Makelong Muang Samutsongkhran\n";
cout<<"Email : pratya_ham@hot@mail.com\n";
cout<<"Blog : http:// Pratyaham.blogspot.com\n";
cout<<"-------------------------------------------\n";
getch();
}

สรุป 27/05/2009

P1208.CPP

/*Program : size_mem.CPP
Process : Display size of memory for each simple data type
Written by : Mr.Pratya
Date : 27/5/2552 */
#include
#include
void main()
{
clrscr();
cout<<"Size of char = "<cout<<"Size of unsigned char = "<cout<<"Size of int = "<cout<<"Size of unsigned int = "<cout<<"Size of short int = "<cout<<"Size of long = "<cout<<"Size of unsigned long = "<cout<<"Size of float = "<cout<<"Size of double = "<cout<<"Size of long double = "<getch();
}

-------------------------------------------------------------

P1308.CPP

/*Program : Pos_var.cpp
Process : Show declared varaible at any position in program */
#include
#include
void main()
{ float sale,price;
clrscr();
sale = 500.25;
price = 5.25;
float total = sale*price;
cout<<"Total Sale = "<getch();
}

------------------------------------------------------------------

P1408.CPP

/*Program : variable.cpp
Process : Display set value of variable */
#include
#include
void main()
{ int number;
float sales,purchase;
//set value of variable
number = 50;
sales = 5000.75;
purchase = 3500.50;
clrscr();
//show varlue from variable
cout<<"show varlue of variable"<cout<<"number ="<cout<<"sales ="<cout<<"purchase ="<getch();
}

-------------------------------------------------------------------

P1508.CPP

/*Program : varia2.cpp
Process : Display set value of variable */
#include
#include
void main()
{ int number = 500; //declaration and set value variable
float sales = 500.50, purchase = 3500.75;//declaration and set value variable
clrscr();//function clear screen from
//show varlue from variable
cout<<"show varlue of variable"<cout<<"number ="<cout<<"sales ="<cout<<"purchase ="<getch();//function getch() for wait to press anyket from
}

-----------------------------------------------------------------

P1608.CPP

/*Program : glo_loc.cpp
Process : define globaland locat variable*/
#include
#include
char grade;// define globaland locat variable
void main()
{
int midterm,final,total;//define globaland locat variable in function main() local
clrscr();
midterm=30;
final=50;
total=midterm+final ;
grade ='a';
cout<<"You get total scare"<<"And get grade =" <getch();
}

------------------------------------------------------------

P1708.CPP

/*Program : const.cpp
Process : Display constant in Program
*/
#include
#include
const float rate = 0.05;//Global constant
void main()
{ const float tax = 0.03; //Local constant
float sales,income,total_tax;
clrscr();
sales = 8500.50;
income = sales*rate;
total_tax = income*tax;
cout<<"Income ="<cout<<"Total tax ="<getch();
}

-----------------------------------------------------------

P2008.CPP

/*Program : logic_tst.cpp
Process : Test logical value of expression
BY Pratya NO.08
DATE 20 MAY 08*/

#include
#include
void main()
{
clrscr();
cout<<"------------------------------\n";
cout<<"\n";
cout<<" BY : Pratya \n ";
cout<<"\n";
cout<<" NO : 08\n";
cout<<"\n";
cout<<"------------------------------\n";
cout<<"\n";
cout<<"Display Logic Operation:\a";
cout<<"\nLogic value of expression(3==5) : "<<(3==5) ;
cout<<"\nLogic value of expression(5==5) : "<<(5==5);
cout<<"\nLogic value of expression(3<=5) : "<<(3<=5);
cout<<"\nLogic value of expression(3>=5) : "<<(3>=5);
cout<<"\nLogic value of expression(3<=5)&&(5>3) : "<<((3<=5)&&(5>3));
cout<<"\nLogic value of expression((3<=5)&&(3>5)) : "<<((3<=5)&&(3>5));
cout<<"\nLogic value of expression((3<=5)(3>5)) : "<<((3<=5)(3>5));
cout<<"\nLogic value of expression((8<=5)(3>=5)) : "<<((8<=5)(3>=5));
cout<<"\n\nValue 1 is true,0 is false ...press any key";
getch();
}

---------------------------------------------------------

J21083.CPP

/*Program : logic_tst.cpp
Process : Test logical value of expression
BY Pratya NO.08
DATE 20 MAY 08*/

#include
#include
void main()
{
int A=20,B=30,C=2,D=5,E=50;
clrscr();
cout<<"------------------------------\n";
cout<<"\n";
cout<<" BY : Pratya \n ";
cout<<"\n";
cout<<" NO : 08\n";
cout<<"\n";
cout<<"------------------------------\n";
cout<<"\n";
cout<<"Display Logic Operation:\a";
cout<<"\n3.1 Logic value of expression (A>=B)&&(A==A) : "<<(A>=B)&&(A==A);
cout<<"\n3.2 Logic value of expression (B+C>A+D)(B+CA+D)(B+Ccout<<"\n3.3 Logic value of expression (A==20)&&(B>=30) : "<<(A==20)&&(B>=30);
cout<<"\n3.4 Logic value of expression (50==E)(!(D<=E)) : "<<(50==E)(!(D<=E));
cout<<"\n3.5 Logic value of expression !(D!=5) : "<cout<<"\n3.6 Logic value of expression (B+C+20)!=50 : "<<(B+C+20)!=50;
cout<<"\n3.7 Logic value of expression C==(D-3) : "<cout<<"\n3.8 Logic value of expression (A/C<=B)&&(C+D<=A)(D>A) : "<<(A/C<=B)&&(C+D<=A)(D>A);
cout<<"\n3.9 Logic value of expression (A%C+5)==(E/5-10) : "<<(A%C+5)==(E/5-10);
cout<<"\n3.10 Logic value of expression (Acout<<"\n\nValue 1 is true,0 is false ...press any key";
getch();
}

---------------------------------------------------------

J21081.CPP

/*Program :
Process :
BY Mr.Pratya NO.08
DATE 27 MAY 09*/

#include
#include
void main()
{
int A=50,B=30,C=5,D=3,E=10;
clrscr();
cout<<"------------------------------\n";
cout<<"\n";
cout<<" BY : Pratya \n ";
cout<<"\n";
cout<<" NO : 08\n";
cout<<"\n";
cout<<"------------------------------\n";
cout<<"\n";
cout<<"1.1 (A+B)*(E-D) = "<<(A+B)*(E-D);
cout<<"\n\n1.2 ++D+C*E = "<<++D+C*E;
cout<<"\n\n1.3 (25+A)/C+B = "<<(25+A)/C+B;
cout<<"\n\n1.4 A*-D = "<cout<<"\n\n1.5 20*C+B+++D/2 = "<<20*C+B+++D/2;
cout<<"\n\n1.6 --D+C+B-- = "<<--D+C+B--;
cout<<"\n\n1.7 25*D/5+10 = "<<25*D/5+10;
cout<<"\n\n1.8 A+B--+D = "<cout<<"\n\n1.9 C*2+E*5 = "<cout<<"\n\n1.10 (A*2)+B/C-15 = "<<(A*2)+B/C-15;

cout<<"\n\n------------------------------\n";
getch();
}

------------------------------------------------------