หน้าแรก
 การบ้าน
  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

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

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

ช่วยดูคำถามนี้หน่อยครับ ไม่ทราบจะเขียนโปรแกรมเป็น C++อย่างไรครับ ใกล้ส่งแล้วด้วยครับ

The program should ask the user n questions or until the user enters -1 to Exit (n should be a constant and it should be equal to the largest digit in your ID number; for example: if your id number is S0090942, n should be 9). The program should generate the following report.

Total number of questions asked
The number of questions correctly answered
The number of questions incorrectly answered
The correct percentage ((correct answers/total questions)*100)
Total number of input prime (Prime-Even + Prime-Odd), even and odd numbers. Note an input number may be in more than one category ? 2 is both a Prime-Even and an even number.
The average value of all input prime numbers
The largest number of all input even numbers
The smallest number of all input odd numbers
จากคุณ : J / kkonlayut@hotmail.com [2005-11-28 07:01:44]  

61.91.225.13 ความคิดเห็น #123 (จาก IP: 61.91.225.13)
ถ้าเป็นผมอยากจะเห็นแนวคิดหรือ Pseducode คร่าวๆ ก่อนนะครับ ถึงค่อยว่ากัน


เป็นการบ้านที่อยากได้เฉลยโดยไม่ต้องคิดเลยหรือเปล่า -_-!!!
จากคุณ : taneung [2005-12-08 10:51:35]

220.101.77.166 ความคิดเห็น #124 (จาก IP: 220.101.77.166)
คร่าวๆน่าจะเป็นประมาณนี้ แต่ไม่รู้ถูกหรือเปล่านะครับ
กำหนดค่าตัวแปร
- จำนวน n ซึ่งได้มาจากเลขที่ค่ามากสุดในรหัส

กำหนดตัวแปรสำหรับ
- จำนวนคำถาม = 0
- จำนวนตอบถูก = 0
- จำนวนตอบผิด = 0

เริ่มลูป
>>ถามคำถาม
>>ใส่พร้อมท์รอคำตอบ
>>เช็คคำตอบ
>>ถ้าไม่ใช่ -1 ให้ทำต่อใน >>>>
>>>>ถ้าถูก เพิ่มค่าตัวแปรตอบถูก
>>>>ถ้าผิด เพิ่มค่าตัวแปรตอบผิด
>>>>นับจำนวนคำถาม
เช็คค่าคำตอบ (ไม่ใช่ -1 หรือไม่) && (ไม่มากกว่า n)

สรุปผลตามคำสั่ง ตามสูตรที่โจทย์ระบุ
แล้วจำนวนเฉพาะหายังไงครับ
จากคุณ : J / kkonlayut@hotmail.com [2005-12-08 12:38:05]

220.101.187.93 ความคิดเห็น #173 (จาก IP: 220.101.187.93)
แบบนี้ OK ไม๊ครับ

#include <iostream>
#include <iomanip>
using namespace std;


void main (void)

{

char Your_answer;
double Average_prime=0;
double Correct_percentage=0;
double Nb_correct=0;
double Total_questions=0;

int Your_input;
int Count=0;
int j=2;
int Nb_incorrect=0;
int Sum_even=0;
int Sum_odd=0;
int Sum_prime=0;
int Total_prime_even=0;
int Total_prime_odd=0;
int Total_all_prime=0;
int Flag_prime=0;
int Largest_even=0;
int First_even=0;
int Smallest_odd=0;
int First_odd=0;

cout<<"Enter a number , -1 to Exit : ";
cin>>Your_input ;

while((Your_input<=0)&&(Your_input!=-1) )
{
cout<<"Please enter a positive number, -1 to Exit : ";
cin>>Your_input ;
}

while ( (Your_input!=-1)&&(Count<9) )
{
Flag_prime = 1;
cout<<"Is "<< Your_input <<" a Prime-Odd/Prime-Even number ?"<<endl;
cout<<"( E for Prime-Even , O for Prime-Odd , R for other numbers )"<<endl; // Display a message
cout<<"Your answer is : " ;
cin>>Your_answer ;

// Check an answer from user
while( ((Your_answer!='E' )&&(Your_answer!='e' ))&& ((Your_answer!='O' )&&(Your_answer!='o' )) &&((Your_answer!='R' )&(Your_answer!='r' )) )
{
cout<<"Please check your answer and try again : " ;
cin>>Your_answer ;
}

for(j=2; j <=(Your_input/2); j++) //Divide by every integer
if((Your_input%j) == 0)
{
cout << "It's not prime; divided by " << j << endl;
Flag_prime = 0;
}

if (Your_input==2)
{
if( ((Your_answer=='E' )||(Your_answer=='e' )) || ((Your_answer=='R' )||(Your_answer=='r' )) )
{
cout<<"Excellent, Your answer is correct."<<endl;
cout << "The number " << Your_input << " is both a Prime-Even and an even number. "<<endl;
Nb_correct++;
Sum_even++;
Sum_prime++;
Total_prime_even+=Your_input;
// Find largest number of even numbers
if ( Your_input > Largest_even)
Largest_even=Your_input;
}
else
{
cout<<"Sorry, Your answer is incorrect."<<'\a'<<'\a'<<endl;
Nb_incorrect++;// Increment the number of incorrectly answered
Sum_even++;
Sum_prime++;
Total_prime_even+=Your_input;


if ( Your_input > Largest_even)
Largest_even=Your_input;
}
}
else if ((Your_input%2==1)&&(Flag_prime == 1)) // check input is Prime-Odd or not
{ // Check an answer from user
if( ((Your_answer=='O' )||(Your_answer=='o' )) || ((Your_answer=='R' )||(Your_answer=='r' )) )
{
cout<<"Excellent, Your answer is correct."<<endl; // Display a message
cout << "The number " << Your_input << " is both a Prime-Odd and an Odd number."<<endl;
Nb_correct++;
Sum_odd++;
Sum_prime++;
Total_prime_odd+=Your_input; // Add Your_input to Total_prime_odd


if (First_odd == 0)
{
First_odd=1;
Smallest_odd = Your_input;
}
else if ( Your_input < Smallest_odd)
Smallest_odd=Your_input;

}
else
{
cout<<"Sorry, Your answer is incorrect."<<'\a'<<'\a'<<endl;
Nb_incorrect++;
Sum_odd++;
Sum_prime++;
Total_prime_odd+=Your_input;


if (First_odd == 0)
{
First_odd=1;
Smallest_odd = Your_input;
}
else if ( Your_input < Smallest_odd)
Smallest_odd=Your_input;

}
}

else if ((Your_input%2==0) || (Your_input%2==1) ) // Check for an even or odd number only not a prime number
{
if((Your_answer=='R' )||(Your_answer=='r' ))
{
cout<<"Excellent, Your answer is correct."<<endl;
cout << "The number " << Your_input << " is other number."<<endl;
Nb_correct++;

}
else
{
cout<<"Sorry, Your answer is incorrect."<<'\a'<<'\a'<<endl;
Nb_incorrect++;
}

if (Your_input%2==0)
{
cout<<"That is an even number."<<endl;
Sum_even++;


if ( Your_input > Largest_even)
Largest_even=Your_input;
}

else if (Your_input%2==1)
{
cout<<"That is an odd number."<<endl;
Sum_odd++;


if (First_odd == 0)
{
First_odd=1;
Smallest_odd = Your_input;
}
else if ( Your_input < Smallest_odd)
Smallest_odd=Your_input;

}
}

Count++;
Total_questions++;
if (Count < 9)
{
cout<<endl<<endl;
cout<<"Enter a number , -1 to Exit : ";
cin>>Your_input ;
while((Your_input<=0)&&(Your_input!=-1) )
{
cout<<"Please enter a positive number, -1 to Exit : ";
cin>>Your_input ;
}
}


}
if (Total_questions==0)
{
Correct_percentage=0;
}
else
{
Correct_percentage = (Nb_correct / Total_questions)*100;
}

Total_all_prime=( Total_prime_even + Total_prime_odd );

if (Total_all_prime==0)
{
Average_prime=0;
}
else
{
Average_prime=static_cast< double >( Total_all_prime )/Sum_prime;
}

cout<<endl<<"====================================================="<<endl;
cout<<"Total number of questions asked : "<< Total_questions<<endl;
cout<<"Number of questions correctly answered :"<<Nb_correct<<endl;
cout<<"Number of questions incorrectly answered :"<<Nb_incorrect<<endl;
cout<<"The correct percentage :"<< setprecision(2) << fixed<<Correct_percentage<<" %"<<endl;
cout<<"Total number of input prime numbers :"<<Sum_prime<<endl;
cout<<"Total number of even numbers :"<<Sum_even<<endl;
cout<<"Total number of odd numbers :"<<Sum_odd<<endl;
cout<<"The average value of all input prime numbers :"<< setprecision(2)<<fixed<<Average_prime<<endl;
cout<<"The largest number of all input even numbers :"<<Largest_even <<endl;
cout<<"The smallest number of all input odd numbers :" <<Smallest_odd<<endl;
cout<<"====================================================="<<endl<<endl<<endl;


} // End function main
จากคุณ : J [2006-01-08 21:00:25]

220.101.187.93 ความคิดเห็น #174 (จาก IP: 220.101.187.93)
แต่อยากทราบว่า ถ้า user ไม่ได้ใส่เป็นตัวเลข จะ check อย่างไรครับ
จากคุณ : J [2006-01-08 21:02:48]
ตอบกระทู้
  • ห้ามการโฆษณา หากต้องการติดต่อหาลูกค้า ติดต่อโฆษณาโดยตรงได้ที่ 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