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

ممكن مساعده فالبرمجه

مغلق
بدأه الإمارات في 10 ديسمبر 2006 · 3 رد · 672 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مرحبا اخواني انا عندي هالاسايمنت ولازم اسلمه الصراحه ها ي محاولتي بس قالت الدكتورة ان فيه اشويه اخطاء ياريت لو حد يقدر يساعدني في :)

هاي محاولتي واسؤال بتحصلونه لاني حملته وشكرا جزيلا بس الدكتورة تقول ماتبغي strcpy لان ماخذنا بعدنه

#include <iostream>

#include <fstream>

#include <iomanip>

#include <cstring>

using namespace std;

int main()

{

char a[21]={'T','F','F','T','F','F','T','T','T','T','F','F',

'T','F','T','F','T','F','T','\0'};

char str[30];

ifstream inFile;

inFile.open ("c://Exam_data.txt");

if (!inFile)

{

cout << "Could not open file.\n";

return 1;

}

while (inFile)

{

cin.get(str[30]);

strcpy(str, "c://Exam_data.txt");

if (strcmp (a[0], str[9])<0)

{

cout << strcmp;

}

cout << str[0,1,2,3,4,5,6,7] << endl;

}

inFile.close();

return 0;

}

Assignment_3.doc

#2

السلام عليكم

اولاً يجب ان تعرف ان المتغير الحرفى هو مصفوفة حروف

بمعنى

char corAns[] = "TTFTFTTTFTFTFFTTFTTF"; // Correct Ans
	char a[21]={'T','F','F','T','F','F','T','T','T','T','F','F',
'T','F','T','F','T','F','T','\0'};

يعملان نفس الوظيفة.

ثانياً: اين الملف Exam_data.txt؟ المفروض يكون مرفق!

المهم انا اعتبر الملف فيه الاجابات فقط. يجب عليك تصحيح الملف ليقراء رقم الطالب.

ثالثاً: اين الكود الخاص بحساب الدرجات. اعتقد ان محاولتك غير كاملة!

على اى حال هذا كود المقارنة و المجموع تركته لك. تحتاج تعديل الملف و كود الدرجات.

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

int main()
{
	int sum, i;
	int questions = 20;  // Number of questions
	int curStudent=0;

	char curAns[21];  // Current Student Answer
	char corAns[] = "TTFTFTTTFTFTFFTTFTTF"; // Correct Ans

	ifstream inFile;
	inFile.open ("Exam_data.txt");
	if (!inFile){
		cout << "Could not open file.\n";
		return 1;
	}
	while (!inFile.eof()){
		curStudent++;
		sum = 0;
		// Read Student ID
		inFile.getline(curAns, 21);
		for (i = 0; i< questions; i++){
			if(curAns != ' '){
				// write here the evaluation
				if(curAns == corAns){ // for example


				}
			}
		}
		cout << "Student" << curStudent<< ":" << sum <<"\n";
	}
	inFile.close();
return 0;
}

Exam_data.txt

#3

اخوي مشكور على ردك بس انا مب فاهمه شو احط فالملف ؟؟ حطيت ها TTF FTTTFTFTFFTTFTTF

TTFTFTTTTTFTFTTTFTTF

FFFTFTTTFTFTFFTTFTTF

TTFTFTTTFTFTFFTTFTTF

بس العملية الحسابية مب قادره اسويها لو بساعدني والسموحه منك

تم تعديل هذه المشاركة بواسطة الإمارات في 11 ديسمبر 2006 في 16:46

#4

السلام عليكم

السؤال فيه كل التفاصيل

اقتباس
Every other entry in the file is the student ID, followed by a blank, followed by the student’s response. For example, the entry

ABC54301 TFTFTFTT TFTFTFFTTFT

والحساب

اقتباس
Each correct answer is awarded two points, each wrong answer gets –1 point, and no answer gets 0 points. Write a program that processes the test data. The output should be: the student ID, followed by the answers, followed by the test score

 if(curAns != ' '){
				// write here the evaluation
				if(curAns == corAns){ // for example
					sum+=2;

				}

التعديل المذكور يضيف الدرجات للاجابة الصحيح و لا اجابة

يجب ان تضيف الخصم طبعاً و تعدل الملف.

و المفروض هذه الاسئلة محتاجة وقت فى مرحلة التعليم. حاول اكثر و من بعد ارينا المحاولة.

بالتوفيق

هذا الموضوع مغلق.

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