Tc Night Section
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Tc Night Section


 
บ้านGalleryLatest imagesค้นหาสมัครสมาชิก(Register)เข้าสู่ระบบ(Log in)

 

 เรียนท่าน เทพฟรั้งค์ ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ

Go down 
5 posters
ผู้ตั้งข้อความ
Elnino_LastshotZ
พยาบาล รุ่น19
Elnino_LastshotZ


จำนวนข้อความ : 101
Registration date : 12/11/2008

เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Empty
ตั้งหัวข้อเรื่อง: เรียนท่าน เทพฟรั้งค์ ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ   เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Icon_minitimeMon Nov 24, 2008 9:56 pm

จัดมา 1 Flower คร๊าบบบ ท่านเทพฟรั้งค์
ขึ้นไปข้างบน Go down
Krt
Tc Night Section Master
Krt


จำนวนข้อความ : 48
Age : 34
Registration date : 11/11/2008

เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Empty
ตั้งหัวข้อเรื่อง: Re: เรียนท่าน เทพฟรั้งค์ ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ   เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Icon_minitimeTue Nov 25, 2008 12:35 am

ขอมาจัดไปแบบเรียบๆ ตั้งแต่ 1-11 เลย

Lap 1
#include <iostream>
using namespace std;
void main()
{
printf("123456789012345678901234567890123456789012345678901234567890\n");
printf("%-10s%-20s%-10s%10s\n","Semester","Class","Amount","Max Grade");
printf("%-10s%-20s%10d%10.2f\n","1/2549","Tc.1",134,3.12);
printf("%-10s%-20s%10d%10.2f\n","1/2549","Tc.1/1",83,3.58);
printf("%-10s%-20s%10d%10.2f\n","2/2549","Tc.2",123,2.97);
printf("%-10s%-20s%10d%10.2f\n\n","2/2549","Tc.2/1",69,2.81);
printf("%30s%10d\n","Total Student",409);
printf("%30s%20.2f\n\n","Max Grade",3.58);
}


Lap 2
#include <iostream>
using namespace std;
void main ()
{
int a=4;
long b=50;
float c,d,e,f;
printf("%f\n",d=(float)(b/a));

int m=50,n=10,o=20;
printf("%d\n",o-=(m>50||n<=10)?n++:m/n);
}


Lap 3
#include <iostream>
#include <string.h>
using namespace std;
void main()
{
int income=1*2*3*4*5*6*7*8*9*10;
printf("%d\n",income);
int vat=income*7/100;
printf("%d\n",vat);
bool rich=income>1000000;
printf("%d\n",rich);
char msg[20];
rich?strcpy(msg,"How do you do"):strcpy(msg,"What's up?");
printf("%s\n",msg);
bool sufficient=income<1000000&&income>200000;
printf("%d\n",sufficient);
char grade=sufficient?'A':'Z';
printf("%c\n",grade);
}


Lap 4
#include <iostream>
using namespace std;
#define VAT 0.07
void main()
{
char namegoods1[20],namegoods2[20],namegoods3[20];
int amount1,amount2,amount3;
float unitprice1,unitprice2,unitprice3,pricegoods1,pricegoods2,pricegoods3,totalprice,totalvat,totalnet;
cout<<"Enter Namegoods1 :"; cin>>namegoods1;
cout<<"Enter Amount1 :"; cin>>amount1;
cout<<"Enter Unitprice1 :"; cin>>unitprice1;
cout<<"\nEnter Namegoods2 :"; cin>>namegoods2;
cout<<"Enter Amount2 :"; cin>>amount2;
cout<<"Enter Unitprice2 :"; cin>>unitprice2;
cout<<"\nEnter Namegoods3 :"; cin>>namegoods3;
cout<<"Enter Amount3 :"; cin>>amount3;
cout<<"Enter Unitprice3 :"; cin>>unitprice3;

pricegoods1=amount1*unitprice1;
pricegoods2=amount2*unitprice2;
pricegoods3=amount3*unitprice3;

totalprice=pricegoods1+pricegoods2+pricegoods3;
totalvat=VAT*totalprice;
totalnet=totalprice+totalvat;

cout<<"\n\nNameGoods1 :"<<namegoods1<<"\nAmount1 :"<<amount1<<"\tUnitPrice1 :"<<unitprice1;
cout<<"\nPricegoods1 :"<<pricegoods1<<"\n\n";
cout<<"NameGoods2 :"<<namegoods2<<"\nAmount2 :"<<amount2<<"\tUnitPrice2 :"<<unitprice2;
cout<<"\nPricegoods2 :"<<pricegoods2<<"\n\n";
cout<<"NameGoods3 :"<<namegoods3<<"\nAmount3 :"<<amount3<<"\tUnitPrice3 :"<<unitprice3;
cout<<"\nPricegoods3 :"<<pricegoods3;
cout<<"\n\n\nTotalPrice :"<<totalprice;
cout<<"\nTotalVat :"<<totalvat;
cout<<"\nTotalNet :"<<totalnet<<endl;
}



Lap 5
#include <math.h>
#include <iostream>
using namespace std;
float pointdist();
int x1,x2,z1,z2;
void main()
{
float distance;
cout<<"x1="; cin>>x1;
cout<<"x2="; cin>>x2;
cout<<"z1="; cin>>z1;
cout<<"z2="; cin>>z2;
distance=pointdist();
cout<<"\n\n"<<"x1="<<x1<<"\tx2="<<x2<<"\ty1="<<z1<<"\ty2="<<z2<<endl;
cout<<endl<<"P1*P2="<<distance<<"\n\n";
}

float pointdist()
{
float p2p,e,ea,f,fa,g,h,i;
e=x1-x2;f=z1-z2;ea=fabs(e);fa=fabs(f);
g=pow(ea,2);h=pow(fa,2);
i=g+h;p2p=sqrt(i);
return p2p;
}



Lap 6
#include <iostream>
using namespace std;
void pointmid(float x1,float y1,float x2,float y2,float *x,float *y);
void main()
{
float a,b,c,d,e,f;
cout<<"A="; cin>>a;
cout<<"B="; cin>>b;
cout<<"C="; cin>>c;
cout<<"D="; cin>>d;
pointmid(a,b,c,d,&e,&f);
cout<<"\nA="<<a<<"\tB="<<b<<"\nC="<<c<<"\tD="<<d<<"\nE="<<e<<"\tF="<<f<<endl;
}

void pointmid(float x1,float y1,float x2,float y2,float *x,float *y)
{
*x=(x1+x2)/2;
*y=(y1+y2)/2;
}



Lap 7
#include <iostream>
#include <time.h>
using namespace std;
void main()
{
int dx,mx,yx,d,m,my,y,yy;
time_t tx;
struct tm *aa;
time(&tx);
aa=localtime(&tx);
cout<<"Enter you birthday:(example) 24(Day) 10(Month) 1890(Year)\n";
cout<<"Enter you birthday:"; cin>>dx>>mx>>yx;

if(aa->tm_mday>=dx){d=aa->tm_mday-dx;my=aa->tm_mon+1;}
else{d=aa->tm_mday+30-dx;my=aa->tm_mon;}
if(my>=mx){m=my-mx;yy=aa->tm_year+1900;}
else{m=my+12-mx;yy=aa->tm_year+1899;}
y=yy-yx;

cout<<"\nYou age is :\t"<<d<<"Day\t"<<m<<"Month\t"<<y<<"Year"<<endl;

switch(mx){
case 1 :cout<<"You birthmonth is January\n";break;
case 2 :cout<<"You birthmonth is February\n";break;
case 3 :cout<<"You birthmonth is March\n";break;
case 4 :cout<<"You birthmonth is April\n";break;
case 5 :cout<<"You birthmonth is May\n";break;
case 6 :cout<<"You birthmonth is June\n";break;
case 7 :cout<<"You birthmonth is July\n";break;
case 8 :cout<<"You birthmonth is August\n";break;
case 9 :cout<<"You birthmonth is September\n";break;
case 10 :cout<<"You birthmonth is October\n";break;
case 11 :cout<<"You birthmonth is November\n";break;
case 12 :cout<<"You birthmonth is December\n";break;
}

if(dx<=0||dx>31||mx<=0||mx>12)cout<<"\nYou Enter Wrong Birthday,It is your Joke? :)\n";
else if(dx==aa->tm_mday&&mx==aa->tm_mon+1)cout<<"\nHappy Birthday to you. :D\n";
else cout<<"\nGood Luck.\n";

}



Lap 8
#include <iostream>
#include <string.h>
using namespace std;
char*numtext(int num);
void main()
{
long nb,nx,h=1000000000;
char te[10];
cout<<"Enter Number:"; cin>>nb;
while(h!=1){
h/=10;
nx=nb/h;
while(nx>9)nx%=10;
strcpy(te,numtext(nx));
cout<<te<<" ";
}

}

char*numtext(int num)
{
static char tt[10];
switch(num){
case 0 :strcpy(tt,"Zero");break;
case 1 :strcpy(tt,"One");break;
case 2 :strcpy(tt,"Two");break;
case 3 :strcpy(tt,"There");break;
case 4 :strcpy(tt,"Four");break;
case 5 :strcpy(tt,"Five");break;
case 6 :strcpy(tt,"Six");break;
case 7 :strcpy(tt,"Seven");break;
case 8 :strcpy(tt,"Eight");break;
case 9 :strcpy(tt,"Nine");break;}
return tt;

}



Lap 9
#include <iostream>
#include <string.h>
using namespace std;
struct cu{char n[30];char t[20];char g;int o;double p;};
double tp(struct cu s);
void main()
{
struct cu xx[20];
int k;
for(k=0;k<20;k++)
{
cout<<"Enter Customer Data\n";
cout<<"Name"<<k+1<<": "; cin>>xx[k].n;
if(strcmp(xx[k].n,"END"));else break;
cout<<"Tel. No.: "; cin>>xx[k].t;
cout<<"Customer Class : "; cin>>xx[k].g;
cout<<"Unit : "; cin>>xx[k].o;
cout<<"Price : "; cin>>xx[k].p;

}
for(k=0;k<20;k++)
{
if(strcmp(xx[k].n,"END"));else break;
cout<<"Customer Name: "<<xx[k].n<<"TotalPrice: "<<tp(xx[k])<<endl;
}
}
double tp(struct cu s)
{
static double tot;
switch (s.g){
case 'a' :tot=(s.p*s.o)-(0.4*s.p*s.o);break;
case 'A' :tot=(s.p*s.o)-(0.4*s.p*s.o);break;
case 'b' :tot=(s.p*s.o)-(0.3*s.p*s.o);break;
case 'B' :tot=(s.p*s.o)-(0.3*s.p*s.o);break;
case 'c' :tot=(s.p*s.o)-(0.2*s.p*s.o);break;
case 'C' :tot=(s.p*s.o)-(0.2*s.p*s.o);break;
case 'd' :tot=(s.p*s.o)-(0.1*s.p*s.o);break;
case 'D' :tot=(s.p*s.o)-(0.1*s.p*s.o);break;
case 'e' :tot=(s.p*s.o);break;
case 'E' :tot=(s.p*s.o);break;
default :0;break;
}
return tot;
}


Lap 10
#include <iostream>
using namespace std;
struct data{int v;struct data *next;};
void an(struct data **se,int nu);
void sa(struct data **se);
int cn(struct data **se);

void main()
{
struct data *ml;
ml=NULL;
an(&ml,1);sa(&ml);
an(&ml,8);sa(&ml);
an(&ml,2);sa(&ml);
an(&ml,7);sa(&ml);
an(&ml,3);sa(&ml);
an(&ml,6);sa(&ml);
an(&ml,4);sa(&ml);
an(&ml,5);sa(&ml);
cout<<cn(&ml)<<endl;

}

void an(struct data **se,int nu)
{
while(*se!=NULL){
se=&(*se)->next;
}
(*se)=new struct data;
(*se)->v=nu;
(*se)->next=NULL;
}

void sa(struct data **se)
{
while(*se!=NULL){
cout<<(*se)->v;
se=&(*se)->next;
}
cout<<endl;
}

int cn(struct data **se)
{
int ct=0;
while(*se!=NULL){
ct++;
se=&(*se)->next;
}
return ct;
}



Lap 11
#include <iostream>
using namespace std;
int mode(int data[],int num);

void main()
{
int fo=0,set,va[27];
cout<<"How many number you have :"; cin>>set;

do{
fo++;
cout<<"\nEnter you number["<<fo<<"] :"; cin>>va[fo-1];
}while(fo!=set);

cout<<"Mode of all you number :"<<mode(va,set)<<endl;
}

int mode(int data[],int num)
{
int co[11],cou=0,t=0,s=0;
for(cou=0;cou<11;cou++)
co[cou]=0;
for(cou=1;cou!=num;cou++)
switch(data[cou-1]){
case 0 :co[0]++;break;
case 1 :co[1]++;break;
case 2 :co[2]++;break;
case 3 :co[3]++;break;
case 4 :co[4]++;break;
case 5 :co[5]++;break;
case 6 :co[6]++;break;
case 7 :co[7]++;break;
case 8 :co[8]++;break;
case 9 :co[9]++;break;
case 10 :co[10]++;break;
}

for(cou=0;cou<10;cou++)
if(co[cou]>s) {s=co[cou]; t=cou;}

return t;

}


แก้ไขล่าสุดโดย Krt เมื่อ Thu Nov 27, 2008 9:24 pm, ทั้งหมด 2 ครั้ง
ขึ้นไปข้างบน Go down
http://tcnightsection.formyjob.net
fanmam
พลอิสระ
fanmam


จำนวนข้อความ : 61
Registration date : 13/11/2008

เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Empty
ตั้งหัวข้อเรื่อง: Re: เรียนท่าน เทพฟรั้งค์ ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ   เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Icon_minitimeTue Nov 25, 2008 1:44 am

เจ๋งเลยฟรั้ง
ขึ้นไปข้างบน Go down
Elnino_LastshotZ
พยาบาล รุ่น19
Elnino_LastshotZ


จำนวนข้อความ : 101
Registration date : 12/11/2008

เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Empty
ตั้งหัวข้อเรื่อง: Re: เรียนท่าน เทพฟรั้งค์ ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ   เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Icon_minitimeWed Nov 26, 2008 12:19 am

Thx หลายๆ ค๊าบท่านเทพ cheers
ขึ้นไปข้างบน Go down
[C]ho[13]itz[X]
พลอิสระ
[C]ho[13]itz[X]


จำนวนข้อความ : 28
Registration date : 16/11/2008

เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Empty
ตั้งหัวข้อเรื่อง: Re: เรียนท่าน เทพฟรั้งค์ ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ   เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Icon_minitimeWed Nov 26, 2008 1:49 am

เอางี้เลยหรอฟรั้งค์

จัดมาให้เป็นไฟล์จะดีกว่านี้ไหม

เอิกๆๆๆ

รบกวนหน่อยๆๆ
ขึ้นไปข้างบน Go down
ViewDevils
พลอิสระ



จำนวนข้อความ : 50
Registration date : 12/11/2008

เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Empty
ตั้งหัวข้อเรื่อง: Re: เรียนท่าน เทพฟรั้งค์ ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ   เรียนท่าน เทพฟรั้งค์  ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ Icon_minitimeSat Nov 29, 2008 2:13 pm

สะจัยบ่ะ




แต่คิงเอธิบายหื้อได้เหมือนมันละกั๋น



ฮ่าๆๆ
ขึ้นไปข้างบน Go down
 
เรียนท่าน เทพฟรั้งค์ ช่วยอัพ ใบงาน ภาษา C++ หน่อยค๊าบบบบบบ
ขึ้นไปข้างบน 
หน้า 1 จาก 1
 Similar topics
-
» ภาษา C
» ใบงาน Array เอาไว้เปนแนวสอบ อ.อนันต์

Permissions in this forum:คุณไม่สามารถพิมพ์ตอบ
Tc Night Section :: Tc Talk :: Tc Share Flie-
ไปที่: