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

سؤال بال C++

بدأه حسن_1 في 31 مارس 2010 · 6 رد · 686 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم و رحمة الله و بركاته

حاب أسئلكم سؤال الحين مثلا في هذا الكود

#include <iostream>

using std::cin;
using std::cout;
using std::endl;

#include <string>

using std::getline;
using std::string;

int main()
{
int stu_num,choice,quzzez,homework,finalexzam,research;
string comet;

cout << "Enter student number: ";

cin >> stu_num ;

if ( stu_num == 11111)
{
cout << "Wlecome to the student college profile \n" << endl ;

cout << "1- Student profile \n 2-Student acadmic State \n 3-Send a message to the student \n 4-Enter Student dagree \n";

cout << "What do you went to do (Enter the Number): \n " << endl;
}

else
{ 
cout << "worng number \n";

return 0;

}

}

مثلا مثل ما أنتو شايفين لا أدخلت رقم غير الواحد يعطني الرساله اللي كتبتها لكن يقفل البرنامج أبي أعرف كيف أخلي الداله ترجع من جديد لما يكتب المستخدم الرقم الصحيح فهمتو علي اللي هو stu_num=1

#2

اضف هذا السطر قبل Return

system("pause");

تحياتي

تم تعديل هذه المشاركة بواسطة omani في 31 مارس 2010 في 23:59

OMANI FOR EVER

-------------------------------------------------

post-12787-12780191801974.jpg

-------------------------------------------------

#3

الله يعافيك على الرد بس تجيني

bash-2.02$ g++ new2.cpp
bash-2.02$ ./a.exe
Enter student number: 33
worng number
pause: not found

الله يعافيك على سرعة الرد

#4

جرب هذا

#include <iostream>
#include <string>

using namespace std;

int main()
{
int stu_num,choice,quzzez,homework,finalexzam,research;
string comet;

cout << "Enter student number: ";

cin >> stu_num ;

if ( stu_num == 11111)
{
cout << "Wlecome to the student college profile \n" << endl ;

cout << "1- Student profile \n 2-Student acadmic State \n 3-Send a message to the student \n 4-Enter Student dagree \n";

cout << "What do you went to do (Enter the Number): \n " << endl;
}

else
cout << "worng number \n";

system("pause");
return 0;


}

تحياتي

OMANI FOR EVER

-------------------------------------------------

post-12787-12780191801974.jpg

-------------------------------------------------

#5

اللي أبيه أنه البرنامج لا دخل رقم الطالب خطأ يرجع إلى أن يتم أدخال رقم الطالب الصحيح في حالتي رقم الطالب اللي وضعته 1

أريد إذا المستخدم أدخل رقم خطأ يرجع إلى أن يتم أدخل رقم صحيح مثل الباسورد إذا أدخلته غلط لا يتم الدخول إلا إذا أدخلت الباسورد الصحيح

والداله التي أنت أستخدمتها تستخدم لتشغيل برامج خارجيه مثل

      system("C:\Program Files\PowerMenu\PowerMenu.exe")
#6

تفضل :

#include <iostream>
#include <string>

using namespace std;

int main()
{
int stu_num,choice,quzzez,homework,finalexzam,research;
string comet;

do{
   cout << "Enter student number: ";
   cin >> stu_num ;
   if(stu_num!=11111)
    cout << "worng number \n";
} while(stu_num!=11111);

cout << "Wlecome to the student college profile \n" << endl ;

cout << "1- Student profile \n 2-Student acadmic State \n 3-Send a message to the student \n 4-Enter Student dagree \n";

cout << "What do you went to do (Enter the Number): \n " << endl;

system("pause");
return 0;
}

تحياتي

1

OMANI FOR EVER

-------------------------------------------------

post-12787-12780191801974.jpg

-------------------------------------------------

#7

استخدم while لحل المشكلة .

...

while(stu_num != 11111)
{
cout<<"error";
cin>>stu_num;
}

cout << "Wlecome to the student college profile \n" << endl ;

cout << "1- Student profile \n 2-Student acadmic State \n 3-Send a message to the student \n 4-Enter Student dagree \n";

cout << "What do you went to do (Enter the Number): \n " << endl;

...

تم تعديل هذه المشاركة بواسطة azeez00 في 1 أبريل 2010 في 03:31

سبحان الله , الله اكبر , ولله الحمد

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