- تاريخ التسجيل
- 3 يوليو 2007
- المشاركات
- 4,299
- المجموعة
- أنثى
- الدفعة الدراسية
- معلومة خاصة
- الكلية
- كلية العلوم
- التخصص
- .
وهذا حل ثالث سؤال بس مادري اذا في طريقه ثانيه للحل لاني حليته بطريقه طويله شوي :thumbdown:
PHP:#include <iostream> #include <fstream> using namespace std; int main() { ifstream fin; ofstream fout; fin.open("binary.dat"); fout.open("decimal.dat"); int binary; while (!fin.eof()) { fin>>binary; switch(binary) { case 0000:cout<<"The binary number is 0000"<<endl<<"The equivalent decimal number is 0"<<endl;break; case 0001:cout<<"The binary number is 0001"<<endl<<"The equivalent decimal number is 1"<<endl;break; case 0010:cout<<"The binary number is 0010"<<endl<<"The equivalent decimal number is 2"<<endl;break; case 0011:cout<<"The binary number is 0011"<<endl<<"The equivalent decimal number is 3"<<endl;break; case 0100:cout<<"The binary number is 0100"<<endl<<"The equivalent decimal number is 4"<<endl;break; case 0101:cout<<"The binary number is 0101"<<endl<<"The equivalent decimal number is 5"<<endl;break; case 0110:cout<<"The binary number is 0110"<<endl<<"The equivalent decimal number is 6"<<endl;break; case 0111:cout<<"The binary number is 0111"<<endl<<"The equivalent decimal number is 7"<<endl;break; case 1000:cout<<"The binary number is 1000"<<endl<<"The equivalent decimal number is 8"<<endl;break; case 1001:cout<<"The binary number is 1001"<<endl<<"The equivalent decimal number is 9"<<endl;break; case 1010:cout<<"The binary number is 1010"<<endl<<"The equivalent decimal number is 10"<<endl;break; case 1011:cout<<"The binary number is 1011"<<endl<<"The equivalent decimal number is 11"<<endl;break; case 1100:cout<<"The binary number is 1100"<<endl<<"The equivalent decimal number is 12"<<endl;break; case 1101:cout<<"The binary number is 1101"<<endl<<"The equivalent decimal number is 13"<<endl;break; case 1110:cout<<"The binary number is 1110"<<endl<<"The equivalent decimal number is 14"<<endl;break; case 1111:cout<<"The binary number is 1111"<<endl<<"The equivalent decimal number is 15"<<endl;break; } } fin.close (); fout.close (); return 0; }
مستانس على الـ eof

حالياً ما يخطر في بالي غير هالطريقة الطويلة , صحيحة
بس فيها شي غلط
يبونك تحط الـ output في فايل مو على الشاشة !
فاتح الفايل ومبرزنه ولا استخدمه

موفقين جميعا ً


:tears:
تصدقين مستانس على eof 


