الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Count

بدأه خوله88 في 2 أكتوبر 2008 · 4 رد · 675 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Write a C++ function to grade a multiple-choice exam. The exam has 20 questions, each answered with a letter in the range of 'a' through 'f'. The function should receive the data from the main program, process the request and send the output to the corresponding output file. The main program should read the data, which are stored on a file (exam.data) where the first line is the key, consisting of a string of 20 characters. The remaining lines on the file are exam answers, and consist of a student ID number, a space, and a string of 20 characters. The program should read the key, student ID, and each exam answer and send this data to the function, which should process the request and output the ID number and score to an output file (scores.out). Erroneous input should result in an error message. For example, given the data:

abcdefabcdefabcdefab

1234567 abcdefabcdefabcdefab

9876543 abddefbbbdefcbcdefac

5554446 abcdefabcdefabcdef

4445556 abcdefabcdefabcdefabcd

3332221 abcdefghijklmnopqrst

The program would output on scores.out file

1234567 20

9876543 15

5554446 Too few answers

4445556 Too many answers

3332221 Invalid answers

#2
# include <iostream>
# include <fstream>


using namespace std;

int main () {
 const max = 20;
 char Ans1[max];
 int count, grade;
 int IDnumber;

 ifstream infile;
 infile.open ("exams.txt");

 ofstream  outFile;
 outFile.open ("scores.txt");

 if (!infile) {

  cout <<"Can't open input file. "<<endl;

  return 0;
 }

 while (infile) {
  while ( Ans1[count] != '\n' ){

  infile >> Ans1[count];

  count++;
  }
 }

 grade = 0;

 while (infile){

  while (Ans1[count] > 'a' && Ans1[count]<'f')}

  infile >> IDnumber;

  while ( Ans1[grade] != '\n' ){

   infile >> Ans1[grade];

   if (grade == count){

	float value1 = float function1 ();
	else if (grade > count)
	 cout <<"Too many answares"<<endl;
	else 
	 cout <<"Too few answares"<<endl;


  }




  return 0;
}
#3

حاولت فيها

بس ما عرفت اسوي defention للfunction

فياريت احد يساعدني

وجزاه الله الف خير

#4

ياريت احد يساعدني

محتاجة الحل ضروري

واذا طريقة السوال او طرح السوال غير مفهوم

مستعدة للتوضيح

وجزيتم خيراً

#5

:( :(

مواضيع مشابهة