مشاهدة النسخة كاملة : اللي يعبرني يدخل ويرد يا اعضاء التقنية"اساتذتي"


طيور النورس
15-11-2007, 01:02 AM
السلام عليكم ورحمة الله وبركاته
انصطدمت كثثثثثثثثثير منكم يا اعضاء التقنية ماتعبروني ومطنشيني نزلت موضوع تدخلون وتطلعون ماقيمتوا حلي على الاقل سلموا او حتى هزؤني وشدوا علي
اللحين منزلة استاذة اسئلةصعبة بالنسبة لي فأطلبكم طلب ولاتردوني ساعدوني في حلها
وردوا علي واذا طنشتوني اوعدكم وعد اني ماراح ادخل منتداكم الرائع صراحة
واشكر كل من قدم نصيحة او شرح استفدت منه
ارجو رجاء اخير ان يكون الرد سريع لاني عندي اختبارات "ادعولي"
الاسئلة
===========
Exercise # 1

Open a new C++ source file, and type in the following program.

// your name
//sheet#5, Ex#1

#include<iostream>
using namespace std;

class Game
**

};

//----------------------------------------------------
int main()
**

return 0;
}
//------------------- The End ----------------------





















In this game, the user1 and the user2 choose each one an option between stone, scissors and paper. Stone wins over scissors, scissors over paper and paper over stone:
stone -> scissors -> paper -> stone...
The first who wins WINSCORE times is the competition winner.







1. Define the following data members of the class Game:

User1: The first user choices.
User2: The Second user choices.2. The program should be capable of performing the following functions:
a. Setting the data members.
b. Displaying on the screen the user1 , and user 2 chooses.
c. Function WhoWins that check which of the characters passed wins and return values:
0= tie, 1=the first, 2=the second, -1=error
===============
Exercise # 2

The following class deal with Student information.
// Student information class
..
..
enum status{regular, dropped, excused, unspecified};
class student_recored{
string name;
long ID;
float GPA;
status student_status;
public:
student_record(string n, long id)
**
new_student(n,id);
}
void new_student(string, long);
float retrieve_GPA(long);
status get_status(long);
status set_status(long);
void print_students( );
……
};
int main()
**
……
student_record studen1("Lima Fahad", 42410), student2, student3;
student.new_student("Mona Saad", 42401);
…….
return 0;
}








- You should add 10 new student and maintain their information which name, id, status.
- You also should define a function that called SearchId which search for a target ID in all your students list.
- This program should contain a menu for choose which one of these two function like this menu

*******************
….Welcome To Student Program…
Choose one of the following :-
1- Add students.
2- Print the GPA for all students.
3- Print all Students Information.
4- Exit …
********************

==========
Exercise # 3 Problem about Random Number Generation.


Write a program that deal with two function

- First function TenRandNum use for print ten real random number. Note: use rand() function.

- Second function GuessNum that contain two variables one as iGuess that refer to the number that get form the user, and iSecret that refer to the random number. This function should compare between these two variables and display if that the iGuess identical to iSecret or higher or lower, as the following output.


Guess the number (1 to 10): 5The secret number is higherGuess the number (1 to 10): 8The secret number is lowerGuess the number (1 to 10): 7Congratulations!

- This program should contain a menu for choose which one of these two function like this menu

*******************
Choose one of the following :-
1- print ten ramdom number.
2- Guess the number
3- Exit.
********************

منطلق بطموحي
15-11-2007, 02:49 PM
السلام عليكم:

السياسة التي اتبعها في المنتدى هي كالتالي:

لا اقدم اي مساعدة الا حينما ارى المحاولات في السؤال لان الحل الجاهز لن يفيد اطلاقا بل بالعكس سيضر

طيور النورس
15-11-2007, 06:25 PM
و عليكم السلام و الرحمه


شكرا على الرد

وهذه محاولتي حليت السؤال الثاني والاسئلة البقية لم اعرفها
#include<iostream.h>
using namespace std;
#include<string<
enum status{regular,excused,unspecified}
class studentrecord
}
string name;
long id;
float gpa;
public:
void setname(stringx)
{name=x;}
void setid(longy)
**;id=y}
void setgpa(floatz)
{gpa=z;}
string getname()
{return name;}
long getid()
{return id;}
float getgpa()
{return gpa;}
;**
int main()
**
string x;
long y;
float z;
int num;
int i;
cout<<"enterthe num";
cin>>num;
studentrecord a[i]];
for(i=0;i<num;i++)
**
a[i].setname(x);
a[i].setid(y);
a[i].setgpa(z);
cout<<a[i].getname();
cout<<a[i].getid();
cout<<a[i].getgpa();
}
return 0;
}

منطلق بطموحي
15-11-2007, 08:53 PM
هذا تصحيح الاخطاء اولا كي يعمل على الكومبايلر

#include<iostream>

#include<string>

using namespace std;

enum status{regular,excused,unspecified};
class studentrecord
**
string name;
long id;
float gpa;
public:
void setname(string x)
{name=x;}
void setid(long y)
{id=y;}
void setgpa(float z)
{gpa=z;}
string getname()
{return name;}
long getid()
{return id;}
float getgpa()
{return gpa;}
};
int main()
**

int num;
int i;
studentrecord a[3];
cout<<"enter the num"<<endl;
cin>>num;



for(i=0;i<num;i++)
**

a[i].setname("Mohammed");
a[i].setid(204);
a[i].setgpa(3);
cout<<a[i].getname()<<endl;
cout<<a[i].getid()<<endl;
cout<<a[i].getgpa()<<endl;
}
return 0;
}

الان ال main ليست هي المطلوبة ...اولا لا افهم لماذا تستعمل array ؟
الشيء الثاني نريد عمل menue بمعنى انه يجب ان تضيف switch statment اذا ضغط المستخدم 1 يعمل اضافة
اذا 2 يطبع ال GPA
اذا 3 يطبع كل المعلومات

و شيء آخر اين استعمالك ل enum ؟ و ما هو استعماله ؟ فهذا غير واضح بصيغة السؤال

اذن الان لا بد لك من تعديل ال main