หน้าแรก
 การบ้าน
  C/C++ new
  Java new
  Windows Phone
  แจ้งเรื่องที่ต้องการ
 บทความ
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 แบบเรียนฟรี
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 ซอร์สโค้ด
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 บริการจากเรา
  เปิดท้าย... ขายโค้ด
  Freeware
  อัตราค่าโฆษณา
  รายชื่อลูกค้า
  สถิติผู้เข้าเว็บ
 ดาว์นโหลด
 ค้นหาข้อมูล
 กระดานสนทนา
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
  อื่นๆ
 กระดานงาน
 ลิงค์เว็บ
 เกี่ยวกับผม
 อัตราค่าโฆษณา
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
โปรแกรมเบอร์ดี (BerDee)
โปรแกรมเบอร์ดี (Android)
เกมส์เป่ายิ้งฉุบ
เกมส์เป่ายิ้งฉุบ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ติดต่อสอบถามมาได้ตลอดนะ...
2015-07-29 13:35:58
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:33:54
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:32:51
  ติดต่อสอบถามเข้ามาได้นะ...
2014-01-06 12:47:38
  ถ้ายังหาคนสอนไม่ได้ ก็ลอ...
2013-07-06 01:04:37
  สนใจส่งขอบเขตมาคุยราคาก...
2013-03-24 18:54:20
  ถ้ายังไม่มีคนรับงานติดต...
2012-12-16 19:18:14
  สนใจคะ ติดต่อ 0905076277...
2012-11-12 11:07:46
  รับทำโปรเจ็คนักศึกษาหรื...
2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  เขียนโปรแกรมภาษาจาวา
1.โ...

2023-09-12 11:40:28
  ต้องลอง debug ดูเองครับ
ไล่...

2023-06-08 18:03:06
  ร้านค้าแห่งหนึ่ง จะต้องน...
2021-09-21 08:47:08
  จงเขียนโปรแกรมดำเนินการ...
2021-05-07 15:06:11
  จงเขียนโปรแกรมสำหรับคำน...
2021-03-09 14:21:45
  ขอดู...
2021-01-04 23:56:45
  ขอโค้ดเพื่อทำการเรียนกา...
2020-12-09 23:02:09
  แล้ว ?...
2020-12-09 10:56:34
  จ้า...
2020-10-18 16:53:21
  พอดีผมเหลื่อแค่ตัดสต๊อก...
2020-05-31 21:49:43
  Homework comment
  เขียนโปรแกรมเพื่อรับค่า...
2022-02-24 10:45:17
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  โจทย์การบ้าน c++ เขียนรูปแ...
2020-04-06 11:01:33
  แบบนี้ขอเป็น ภาษา php หน่อย...
2019-09-18 14:36:34
  ผมไม่อยากให้คุณได้คะแนน...
2019-04-27 01:29:07
  อาจารย์เขาบอกแนวข้อสอบม...
2019-04-27 00:44:29
  ขอสอบถามการเขียน c++ ครับ เ...
2018-04-02 12:19:21
  โค้ดตัวอย่างศึกษาให้เข้...
2017-11-26 14:50:05
  คำนวณค่าน้ำโดยรับค่ามิเ...
2017-11-20 23:15:26
  Article comment
  เท่าที่อ่าน error คือพื้นที่...
2022-03-23 13:56:48
  เรียน สอบถามปัญหา กับ อ.คร...
2022-01-24 17:39:49
  ต้องการ ให้เขียน โปรแกรม ...
2019-12-09 11:39:58
  รับเขียน arx จาก vc++ 2017 ล็อคโปร...
2019-09-19 09:48:09
  ทำการ register ไฟล์ที่ชื่อ mswinsck.oc...
2019-09-17 14:05:56
  ใน vb 6 ไม่มี component winsock เลยค่ะ ส...
2019-09-03 10:31:02
  รบกวนขอสอบถามหน่อยนะครั...
2019-03-04 05:31:04
  สามารถนำตัวหนังสือจากภา...
2018-12-25 08:54:32
  มีcode ของ VB ไหมค่ะ ถ้ามีรบกว...
2017-09-28 16:50:02
  น่าจะได้ครับ ไม่เคยลอง
...

2017-07-11 09:59:35
  9Mcode comment

Link Exchange

อัตราค่าโฆษณา
 
 Webboard

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

กระทู้ #3061 [C] (จาก IP: 223.205.130.126)

อยากให้โปรแกรมมันวนรอบการทำงานครับ ช่วยทีครับ

หลังจากที่หายไปหลายอาทิตย์ ผมก็งม ๆ มั่วๆไปแบบของผม
งานต้องส่งวันที่ 4 นี้แล้ว แต่ไปไม่ถึงไหนเลย
ก็คงต้องส่งเท่าที่ทำได้หละครับ T^T


ตอนนี้ติดปัญหาคืออยากให้โปรแกรมมัน วนรอบการทำงาน
อยากให้มันกลับไปที่เมนูคืนครับ

นี้โปรแกรมผมครับ ช่วยทีนะครับ Please

#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

void timee(void)
{
tm*iTDTimeInfo;
time_t rtime;

time(&rtime);
iTDTimeInfo=localtime(&rtime);

printf("\t\t\t\t\t\t\t%s\n",asctime(iTDTimeInfo));
}

void starline1(void)
{
printf("***** **** *** ** * ** *** **** *****\n");
}

void starline2(int k)
{
int o;
for(o=1; o<=k; o++)
printf("*");
printf("\n");
}

main()
{
char choice;
timee();
char* t1="\t\t** Wellcome **\n";
char t2[44]="\t\t** To **\n";
char t3[]="\t\t** Study Room **\n";
char t4[6]={'M','.','3','/','5','\0'};
char t5[10]={'S','r','i','n','d','h','o','r','n'};
char t6[]={'S','c','h','o','o','l','\0'};

printf("\t\t");starline1();
printf("\t\t** (^_^ ) **\n");
printf("%s",&t1[0]);
printf("%s",&t2);
printf("%s",&t3);
printf("\t\t** %s **\n",&t4);
printf("\t\t** %s **\n",&t5);
printf("\t\t** %s **\n",&t6);
printf("\t\t** ( ^_^) **\n");
printf("\t\t");starline1();
getch();
printf("\n\n");starline2(37);
printf("** Please select the Actions menu. **\n");
starline2(37);
printf("a.Results of study\n");
printf("b.Calculator\n");
printf("c.Multiplication table\n");
printf("d.For students to sign\n");
printf("e.Check List for Administrator\n");
printf("f.Add id\n");
scanf("%c",&choice);
clrscr();


switch(choice)
{
case'a':
{
timee();
int number;
printf("[- = > Results of study < = -]\n\n");
printf("Enter your number: ");
scanf("%d",&number);
if(number>0)
{
if(number>=30)
{
printf("You entered the wrong information\n");
}
else
{
int score;
printf("Enter your total score: ");
scanf("%d",&score);
switch(score/10)
{
case 10:
printf("%d is A+\n",score);
break;
case 9:
printf("%d is A\n",score);
break;
case 8:
printf("%d is B\n",score);
break;
case 7:
printf("%d is C\n",score);
break;
case 6:
printf("%d is D\n",score);
break;
default:
printf("%d is F",score);
}
return 0;
}

}
else
{
printf("You entered the wrong information.");
}
return 0;
break;
}

case'b':
{
timee();
double number1 = 0.0;
double number2 = 0.0;
char operation = 0;

printf("[- = > Calculator < = -]\n\n");
printf("\nEnter the calculation\n");
scanf("%lf %c %lf", &number1, &operation, &number2);

switch(operation)
{
case '+':
printf("= %lf\n", number1+ number2);
break;

case '-':
printf("= %lf\n", number1 - number2);
break;

case '*':
printf("= %lf\n", number1 * number2);
break;

case '/':
if(number2 == 0)
printf("\n\n\aDivision by Zero #ERROR!\n");
else
printf("= %lf\n", number1 / number2);
break;

case '%':
if((long)number2 == 0)
printf("\n\n\aDevision by Zero #ERROR!\n");
else
printf("= %ld\n", (long)number1 % (long)number2);
break;

default:
printf("\n\n\aIllegal operation!");
}
return 0;
break;
}

case'c':
{
timee();
printf("\t\t- = > [ Multiplication table ] < = -\n\n");
printf(" 1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t");
printf("\n");
for(int c=1;c<11;c++)
{
printf("%d|",c);
for(int i=1;i<11;i++)
{
printf("%d\t",i*c);
}
printf("\n");
}
return 0;
break;
}

case'd':
{
timee();
FILE *fpt;
char loop = 'Y';

struct terng
{
char name[40];
int number;
float money_daily;
};
struct terng p;

fpt = fopen("D:/dat/terng.txt","w");

if(fpt==NULL)
{
printf("Error..cannot open file!\n");
exit(0);
}

while(loop == 'Y')
{
printf("Enter Name, Number and MoneyDaily => ");
scanf("%s %d %f",p.name,&p.number,&p.money_daily);

fprintf(fpt,"%s %d %f\n", p.name,p.number,p.money_daily);
fflush(fpt);

printf("Add another record [Y/N]: \n");
loop = toupper(getche());
}
fclose(fpt);
printf("\n\n");

return 0;
break;
}

case'e':
{
timee();
FILE *fpt;
struct terng1
{
char name[40];
int number;
float money_daily;
};

struct terng1 h;

fpt = fopen("D:/dat/terng.txt","r");


if(fpt==NULL)
{
printf("Error..cannot open file!\n");
exit(0);
}

printf("Name\t Number MoneyDaily\n");
printf("--------------------------\n");
while(fscanf(fpt, "%s %d %f",h.name,&h.number,&h.money_daily) !=EOF)
printf("%-10s%2d %9.2f\n", h.name,h.number,h.money_daily);

fclose(fpt);
printf("\n");

return 0;
break;
}

case'f':
{
timee();
struct terng2
{
char name[40];
int number;
float money_daily;
};

struct new_terng
{
int id;
char name[40];
int number;
float money_daily;
};

struct terng2 j;
struct new_terng u;

FILE *fpt1,*fpt2;
fpt1 = fopen("D:/dat/terng.txt","r");
fpt2 = fopen("D:/dat/terng.dat","w");

if(fpt1 == NULL || fpt2 == NULL)
{
printf("Error..cannot open file!\n\n");
exit(0);
}

printf("Name\t Number MoneyDaily id\n");
printf("-----------------------------\n");

while(fscanf(fpt1, "%s %d %f", j.name, &j.number, &j.money_daily) != EOF)
{
printf("%-10s %2d %8.2f ", j.name, j.number, j.money_daily);

strcpy(u.name, j.name);
u.number = j.number;
u.money_daily = j.money_daily;

scanf("%d",&u.id);
fprintf(fpt2, "%d %s %d %f\n", u.id,u.name,u.number,u.money_daily);
fflush(fpt2);
}

fclose(fpt1);
fclose(fpt2);

remove("D:/dat/terng.txt");

rename("D:/dat/terng.dat","D:/dat/terng.txt");

printf("\nCopy data to new stucture successful.\n\n");

return 0;
break;
}


}

}
จากคุณ : เด็กหัดเดิน [2011-04-03 01:57:21]  

101.108.26.2 ความคิดเห็น #28290 (จาก IP: 101.108.26.2)
ประยุกต์ใช้ lable, goto ดูครับ ตัวอย่าง http://msdn.microsoft.com/en-us/library/b34dt9cd(v=vs.80).aspx
จากคุณ : maddog [2011-04-04 15:05:04]

202.29.24.199 ความคิดเห็น #28291 (จาก IP: 202.29.24.199)
/*มันจะวน loop ภายใน Do ครับ จนเงื่องไขเป็นเท็จคือ n*/
#include<stdio.h>
#include<conio.h>
main()
{
double number1 = 0.0;
double number2 = 0.0;
char operation = 0;
char ans_calculate;
do{
clrscr();
printf("\n\t\t\t :: Calculate + - x / ::\n\a");
printf("\t\t");
printf("\n\n\t\t\tEnter the Number1 Operation Number2");
printf("\n\t\t\t***Example : 1+3 , 2-4 , 3*5 ,4/6\n\n");
printf("\t\t\tInput => ");
scanf("\n%lf %c %lf", &number1, &operation, &number2);
switch(operation)
{
case '+':
printf("\t\t\tResult => %.3f\n", number1+ number2);
break;

case '-':
printf("\t\t\tResult => %.3f\n", number1 - number2);
break;

case '*':
printf("\t\t\tResult => %.3f\n", number1 * number2);
break;

case '/':
if(number2 == 0)
printf("\n\n\aDivision by Zero #ERROR!\n");
else
printf("\t\t\tResult => %.3f\n", number1 / number2);
break;

default:
printf("\n\n\t\t\t\tWrong operation!");
}
printf("\n\n\t\t You Want Calculate + - x / again y/n :> ");
scanf("%s",&ans_calculate);
}while (ans_calculate == 'y');//ใช้while วนloop เมื่อเลือก y
printf("\n\n\n\t\t\t Enter to Main menu....");
getch();
}

/*ลองเอาไปประยุกต์ ใช้Do-while ครอบทั้งหมดดู*/
/*Good Luck Friend*/
จากคุณ : Friend Innovation 221 / deks1tnw@gmail.com [2011-04-05 12:18:23]
ตอบกระทู้
  • ห้ามการโฆษณา หากต้องการติดต่อหาลูกค้า ติดต่อโฆษณาโดยตรงได้ที่ webmaster@sourcecode.in.th
  • ห้ามใช้คำหยาบและคำพูดที่ไม่เหมาะสม
  • ขอสงวนสิทธิหากตรวจพบ ข้อความที่ไม่เหมาะสม ข้อความนั้นจะถูกลบทันที
ชื่อ
อีเมล์
รายละเอียด

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

 
 
คลิปสอนเขียนโปรแกรม
เรียนเขียนโปรแกรมดอทเน็ต
เรียนเขียนโปรแกรมแอนดรอยด์
เรียนเขียนโปรแกรมเบล็คเบอร์รี่
เรียนเขียนโปรแกรมซี ซีพลัสพลัส
เรียนเขียนโปรแกรมจาวา
เรียนการใช้งานลินุกส์
เรียนการเขียนโปรแกรมวินโดว์โฟน
เรียนการเขียนโปรแกรมพีเฮชพี มายเอสคิวเอล
อัตราค่าโฆษณา
 
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
แบบสำรวจ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

สงวนลิขสิทธิ์ ห้ามคัดลอก ทำซ้ำ แก้ไข ดัดแปลง ไม่ว่าในรูปแบบใด โดยไม่ได้รับอนุญาตเป็นลายลักษณ์อักษร
เลขทะเบียนพาณิชย์อิเล็กทรอนิกส์จากกระทรวงพาณิชย์: 7100503002000
Copyright 2001 SourceCode.in.th