2007/Jul/13

มหัศจรรย์ สาวน้อยพริตตี้เคียว แม็กซ์ฮาร์ท จะจบใน เสาร์ที่ 14 กรกฎาคม นี้

จะแทนที่ด้วย ร็อคแมน เอ็กซ์เซ่ แทน

เริ่มออกอากาศตอนแรกในวันอาทิตย์ที่ 15 กรกฎาคม นี้ เวลา 09.00 09.30 น. ทางโมเดิร์นไนน์ทีวี

Credits By http://modernine.mcot.net/cartoon/content_view.php?id=350&t=1


edit @ 2007/07/13 22:14:35

Comment

Comment:

Tweet


//fwrite(&pe,sizeof(struct people),5,fp);
//this collect 5 people, but in text file I can't read it because it is alien word
//Theacher say that it collect 5 people data into 1 data so it become alien word
#22 by +Labb11_5_2 (161.246.1.33 /161.246.70.47) At 2007-09-18 18:40,
Lab11_5_2

#include<stdio.h>
#include<conio.h>
//Now This program can receive data from 5 people
int main()
{
FILE *fp; //We can choose fp or fptr because it is variable that we are titled.
int i; // I give i is variable for forloop
struct people{
char name[20];
char surname[20];
int day;
char month[15];
int year;
}pe; //Don't put pe[5] forloop is enough
fp = fopen("data2.txt","w");
if(fp == NULL)
{
printf("Error \nCannot open file");
return (0);
}
else
printf("Can open file\nPlease Enter to continue..");

for(i=0;i<=4;i++) //give i=0 and count it to 4
{
printf("%d th people",i+1);
printf("\nEnter your name : ");
scanf ("%s",pe.name);
printf("Enter your surname : ");
scanf ("%s",pe.surname);
printf("Enter your birthday \n");
printf("\t Day : ");
scanf ("%d",&pe.day);
printf("\t Month : ");
scanf ("%s",pe.month);
printf("\t Year : ");
scanf ("%d",&pe.year);

//fwrite(&pe,sizeof(struct people),5,fp);
//this collect 5 people, but in text file I can't read it because it is alien word

fprintf(fp,"%s %s",pe.name,pe.surname);
fprintf(fp,"%d %s %d\n",pe.day,pe.month,pe.year);
//this also collect 5 people and I can read it a human word
}

if(!fclose(fp))
{
printf("\nClose file\n");
}
return 0;
}
#21 by Lab11_5_2 (161.246.1.33 /161.246.70.47) At 2007-09-18 18:22,
Lab11_5


#include<stdio.h>
#include<conio.h>
//This program I write from the order in the worksheet.
//They want me to understand structure and text file.
int main()
{
FILE *fp;
struct people{
char name[20];
char surname[20];
int day;
char month[15];
int year;
}pe;
fp = fopen("data.txt","w");
if(fp == NULL)
{
printf("Error \nCannot open file");
return (0);
}
else
printf("Can open file\nPlease Enter to continue..");

printf("\nEnter your name : ");
scanf ("%s",pe.name);
printf("Enter your surname : ");
scanf ("%s",pe.surname);
printf("Enter your birthday \n");
printf("\t Day : ");
scanf ("%d",&pe.day);
printf("\t Month : ");
scanf ("%s",pe.month);
printf("\t Year : ");
scanf ("%d",&pe.year);

fprintf(fp,"%s %s",pe.name,pe.surname);
fprintf(fp,"%d %s %d\n",pe.day,pe.month,pe.year);

//This structure can only collect 1 people

if(!fclose(fp))
//This order is only check this program close or not. It isn't important.
{
printf("\nClose file\n");
}
return 0;
}
#20 by Lab11_5 (161.246.1.34 /161.246.70.47) At 2007-09-18 17:52,
http://webboard.crsc.kmitl.ac.th/ladkrabang/index.php?PHPSESSID=e54q3h3ajam1rk2fcjsavc0rg2&topic=23049.0

http://webboard.crsc.kmitl.ac.th/ladkrabang/index.php?PHPSESSID=e54q3h3ajam1rk2fcjsavc0rg2&topic=25355.0
#19 by 65ฟหกด4ฟหก4ด54ฟห65 (161.246.1.36 /161.246.70.47) At 2007-09-18 16:46,
http://webboard.crsc.kmitl.ac.th/ladkrabang/index.php?PHPSESSID=e54q3h3ajam1rk2fcjsavc0rg2&action=dlattach;topic=25355.0;attach=2898

ภาษาC
#18 by ภาษาC (161.246.1.36 /161.246.70.47) At 2007-09-18 16:46,
Lab11_4

#include<stdio.h> //This program you can choose text file from the folder, and then copy to new file
#include<conio.h>
int main()
{
FILE *fp,*tp; // This day I test by I give 2 variable. Also I work like 1 variable = ='

char f1[50],f2[50];
//f1 is name of old file
//f2 is name of copy file that you give it
char name1[20],name2[30];
int num;

printf("Enter file that you want to copy : \n");
scanf("%s",f1);
fp = fopen(f1,"r"); // Don't use "f1", program won't find text file name f1
if(fp == NULL)
{
printf("Cannot find file");
return 0;
}
fscanf(fp,"%s\n%s\n%d",name1,name2,&num);
printf("Enter new name of your file : \n");
scanf("%s",f2);


tp = fopen(f2,"w");
fprintf(tp,"%s\n%s\n%d",name1,name2,num);

return 0;
}
#17 by Lab11_4 (161.246.1.34 /161.246.70.47) At 2007-09-18 16:22,
Lab11_3

#include<stdio.h> //This program will receive data from lab11_2round2, text file's name is demo.txt, and copy to backup.txt
#include<conio.h>
/*
In demo.txt don't use like this

First Name : Pirun
Surname Name : Supparittitamrong
Number : 50011112

Because it will be received name1=First name2=Name num=: OK?
*/
int main()
{
FILE *fp;
char name1[20],name2[30];
int num;
fp = fopen("D:/c++/cc/Lab11_2byten/Lab11_2byten/demo.txt","r");

if(fp == NULL) // check it have a file ,haven't it
{
printf("Error \nCannot open file\n");
return 0;
}
else
printf("Can open file\n");//don't forget &
fscanf(fp,"%s\n%s\n%d",name1,name2,&num);//it will collect data from demo.txt

printf("First Name : %s\nSurName : %s\nNumber : %d",name1,name2,num);

fp = fopen("backup.txt","w");
fprintf(fp,"%s\n%s\n%d",name1,name2,num);//Now it write data into backup.txt

return 0;
/*
backup.txt

Pirun
Supparittitamrong
50011112

*/

}
#16 by Lab11_3 (161.246.1.37 /161.246.70.47) At 2007-09-18 15:44,
Lab11_2round2


#include<stdio.h> //I write this program to write text file, its name is demo.txt
#include<conio.h>
int main()
{
FILE *fp;
fp = fopen("demo.txt","w");
char name1[20],name2[30];
int num; // In /* */ I don't have to write it because "w" in fp, it mean write text file.
/*
if(fp == NULL)
{
printf("Error \nCannot open file\n");
return 0;
}
else

printf("Can open file\n");
*/
printf("Enter First Name : ");
scanf("%s",name1);
printf("Enter Surname Name : ");
scanf("%s",name2);
printf("Enter Number : ");
scanf("%d",&num);
fprintf(fp,"%s\n%s\n%d",name1,name2,num);
return 0;
/*
After run the program I got demo.txt in my folder project like this
Pirun
Supparittitamrong
50011112
*/
}
#15 by Lab11_2round2 (161.246.1.36 /161.246.70.47) At 2007-09-18 15:19,
Lab11_2

#include<stdio.h> //I write this program to write text file, its name is demo.txt
#include<conio.h>
int main()
{
FILE *fp;
fp = fopen("demo.txt","w");
char name1[20],name2[30];
int num; // In /* */ I don't have to write it because "w" in fp, it mean write text file.
/*
if(fp == NULL)
{
printf("Error \nCannot open file\n");
return 0;
}
else

printf("Can open file\n");
*/
printf("Enter First Name : ");
scanf("%s",name1);
printf("Enter Surname Name : ");
scanf("%s",name2);
printf("Enter Number : ");
scanf("%d",&num);
fprintf(fp,"First Name : %s \nSurname Name : %s\nNumber : %d",name1,name2,num);
return 0;
/*
After run the program I got demo.txt in my folder project like this
First Name : Pirun
Surname Name : Supparittitamrong
Number : 50011112
*/
#14 by Lab11_2 (161.246.1.33 /161.246.70.47) At 2007-09-18 14:55,
#include<stdio.h> //THis program will test how to work of open of text file. By use order to find test.txt
#include<conio.h>
int main()
{
FILE *fp;
fp = fopen("test.txt","r");
if (fp == NULL)
{
printf("Error \nCannot open file\n");
return 0;
}
else
printf("Can open file\n");

return 0;
}
#13 by lab11_1 (161.246.1.36 /161.246.70.47) At 2007-09-18 14:33,
Lab10_4(unfinish)

#include<stdio.h> //This program is received sentense from user, then tell how long it is and how many in &Ecirc;&Atilde;&ETH; the sentense
char searchword(char*);
int main()
{
char sen[80];
printf("Enter your sentense : ");
scanf("%s",sen);
searchword(sen);
return 0;
}
char searchword(char* sen) //I use char* because allay is similar pointer
{
int a,j;
for(j=1;sen[j]='\0';j++)
a++;
return a;
}
#12 by Lab10_4(unfinish) (161.246.1.36 /161.246.70.47) At 2007-09-11 18:27,
Lab10_3

#include<stdio.h> //This program will receive 2 number, then find prime number between them by using function
int primecheck(int); //If I follow the order use "void primecheck(int)" the function won't show me.
int i,j;
int main()
{

printf("Input the greatest number : ");
scanf("%d",&i);
printf("Input the smallest number : ");
scanf("%d",&j);

if(i==j)
printf("Sorry I can not find prime number for you, baby.");
else if(i<j)
printf("Are you joking!?. I SAY GREATEST NUMBER. DO YOU GET ME?");
else if(i<=1&&j<=1)
printf("Agian please");
else
printf("\n prime number between %d and %d are \n",i,j);
primecheck(i);
return 0;
}

int primecheck(int num)
{
int c,z,var;
while(j<=num)
{
var=j++,c=0,z=1;
while(z<=var)
{
if(var%z==0)
c++;
z++;
}
if(c==2)
printf("%4d",var);
}
return var;
}
#11 by Lab10_3 (161.246.1.35 /161.246.70.47) At 2007-09-11 17:32,
Lab10_2

#include<stdio.h> //This program come from lab10_1. Now this program MUST get 3 number,and then show the greatest number but I can't do anything I my function (follow the order)
int findmax(int,int);

int main()
{
int i,j,z;
printf("Enter number 1 : ");
scanf("%d",&i);
printf("Enter number 2 : ");
scanf("%d",&j);

if(i==j)
printf("%d and %d are equal",i,j);
else
{
findmax(i,j);
printf("\n\nEnter number 3 :");
scanf("%d",&z);
if(i>j)
{
if(i>z&&j>z)
printf("%d is the greatest",i);
else if(i>z&&z>j)
printf("%d is the greatest",i);
else if(z>i)
printf("%d is the greatest",z);
}
else if(j>i)
{
if(j>z&&i>z)
printf("%d is the greatest",j);
else if(j>z&&z>i)
printf("%d is the greatest",j);
else if(z>j)
printf("%d is the greatest",z);
}

}
return 0;
}

int findmax(int x,int y)
{
if(x>y)
printf("%d is the greatest",x,y);
else
printf("%d is the greatest",y,x);
return x,y;
}
#10 by Lab10_2 (161.246.1.37 /161.246.70.47) At 2007-09-11 15:47,
Lab10_1

#include<stdio.h> //This is my first function. Input your 2 number. It will show the greatest number
int findmax(int,int);

int main()
{
int i,j;
printf("Enter number 1 : ");
scanf("%d",&i);
printf("Enter number 2 : ");
scanf("%d",&j);

if(i==j)
printf("%d and %d are equal",i,j);
else
findmax(i,j);
return 0;
}

int findmax(int x,int y)
{
if(x>y)
printf("%d is the greatest",x,y);
else
printf("%d is the greatest",y,x);
return x,y;
}
#9 by Lab10_1 (161.246.1.35 /161.246.70.47) At 2007-09-11 15:24,
มีเเค่นี่หรอ
#8 by ปอนด์ (124.120.242.189) At 2007-09-01 20:37,
มีเเค่นี่หรอ
#7 by ปอนด์ (124.120.242.189) At 2007-09-01 20:37,
ต่อจากLab6__2_6
a ความยาวกี่งหนึ่งของรูป
i กำหนดloopของบรรทัด
j กำหนด*ในแต่ละบรรทัด
#6 by 9845 (161.246.1.33 /161.246.70.47) At 2007-08-21 18:35,
Lab6_2_6

#include<stdio.h>
int main()
{
int a,i,j;
printf("Enter your colume ");
scanf ("%d",&a);
for(i=1;i<=a*2-1;i++)
{
for(j=1;j<=2*a;j++)
{
if(i<=a)
{
if(j<=2*a-i && j>2*a-(2*a-i))
printf(" ");
else
printf("*");
}

else
{
if(j>2*a-i && j<=2*a-(2*a-i))
printf(" ");
else
printf("*");
}

}
printf("\n");
}
return 0;
}
#5 by 8787878 (161.246.1.35 /161.246.70.22) At 2007-08-14 19:04,
Lab 6_2_3

#include<stdio.h>
int main()
{
int num,i,j;
printf("Enter your number : ");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
printf("\n");
for(j=1;j<=num;j++)
{
printf("*");
}
}
return 0;
}



Lab 6_2_4

#include<stdio.h>
int main()
{
int num,i,j;
printf("Enter the number : ");
scanf("%d",&num);
for(i=1;i<=num;i++);
{
printf("\n");
for(j=1;j<=num;j++)
{
if((i+j)%2==0)
printf("*");
else if((i+j)%2!=0)
printf("-");
}
}
return 0;
}

#4 by 5454545 (161.246.1.35 /161.246.70.47) At 2007-08-14 18:29,
Lab 6_2_2


#include<stdio.h>
int main()
{

int i,j,b,c,z;
printf("Enter your highest number : ");
scanf("%d",&i);

printf("Enter your smallest number : ");
scanf("%d",&j);

if(i>j)
{
while(j<=i)
{
b=j++,c=0,z=1;
{
while(z<=b)
{
if(b%z==0)
c++;
z++;
}
if(c==2)
printf("%d\t",b);
}


}
}
else if(i==j)
{
printf("Don't be joking");
}
else
{
printf("Fuck you!");
}
return 0;
}
#3 by 5555666 (161.246.1.36 /161.246.70.47) At 2007-08-14 17:29,
Lab5_3_1

#include<stdio.h>
int main()
{
int a,i;
scanf("%d",&a);
if(a>1)
{
for(i=1;i<=a;i++)
{
printf("%d\n",i);
}
}
else
printf("Are you joking!!");

return 0;
}


Lab 5_3_2

#include<stdio.h>
int main()
{
int a,i,mul=1;
scanf("%d",&a);
printf("Wait a moment\n");

if(a>2)
{
for(i=2;i<=a;i++)
{
mul=mul*i;
}
printf("Product = %d",mul);
}
else
printf("Are you joking!!");

return 0;
}




Lab5_3_3

#include<stdio.h>
int main()
{
int a,i=2,mul=1;
scanf("%d",&a);
printf("Wait a moment\n");

if(a>2)
{
while(i<=a)
{
mul=mul*i;
i++;
}
printf("Product = %d",mul);

}
else
printf("Are you joking!!");

return 0;
}


Lab 5_3_4

#include<stdio.h>
int main()
{
int a,mul=1,i=2;
scanf("%d",&a);
printf("Wait a moment\n");
if(a>2)
{
do
{
mul=mul*i;
i++;
}
while(i<=a);
printf("Product = %d",mul);

}
else
printf("Don't be joked!!");
return 0;
}



Lab 5_3_5

#include<stdio.h>
int main()
{
int a,sum=0;
printf("Wait a moment\n");

do
{
scanf("%d",&a);
sum=sum+a;
}
while(a!=0);
printf("%d",sum);

return 0;
}
#2 by 1234 (161.246.1.35 /161.246.70.58) At 2007-08-07 18:12,
#1 by นฤเทพ จันทร์แก้ว (124.120.229.7) At 2007-07-20 19:51,