تم النشر منذ 3 May 2014 (معدل) مساء اللخير عندي مساله حاوللت احلهاا ولكن فيه شي عقدني ممكن تسااعدوني هذا السوال Write a C++ program that store the following list of countries and currencies in a 2-D array of strings: {{KSA, Riyal} , {UAE, Dirham} , {UK, Pound},{USA, Dollar}}.Then ask the user about his choice of eitherhewant to:Enter country name to know its currency Enter currency name to know which country it belongs to In either choices, the program should output the correspondent information according to the inputted one. If the program does not find the inputted country or currency, it print "Sorry, Not Found" error message. Here are some run samples, وهذه محااولاتي #include <iostream>#include <string>using namespace std;string a[4][2]={{ "KSA", "Riyal"} , {"UAE", "Dirham"} , {"UK", "Pound"},{"USA", "Dollar"}};string d;void countries(){ for (int i=0;i<4;i++) return ;}void currencies(){cout<< " "; return ;}int main(){ int x;cout<< "Hi"<<endl;cout<< "Coose what you want to know "<<endl;cout<< "1. currency name based on country name? \n2. country name based on currency name?"<<endl;cin>>x; switch (x){ case 1: countries(); break; case 2: currencies(); break; default : cout<<"Erorr"<<endl;}system ( "pause"); return 0;} تم تعديل 3 May 2014 بواسطه اشواق الحربي 0 شارك هذا الرد رابط المشاركة شارك الرد من خلال المواقع ادناه
قام بالرد منذ 3 May 2014 ضعي الكود بين هذين الوسمين[*code][*/code]بعد مسح النجوم وذلك للتنسيق 0 شارك هذا الرد رابط المشاركة شارك الرد من خلال المواقع ادناه
قام بالرد منذ 3 May 2014 تمارجو مساعدتي باسرع وقت :tbcorner: 0 شارك هذا الرد رابط المشاركة شارك الرد من خلال المواقع ادناه
قام بالرد منذ 7 May 2014 وما هى المشكلة التى تواجهك ؟؟؟ هل يعطى نتائج غير صحيحة ام انه لا يعمل من الاساس ؟؟؟؟؟ 0 شارك هذا الرد رابط المشاركة شارك الرد من خلال المواقع ادناه
قام بالرد منذ 8 May 2014 هذا هو الحل لمعضلتك، تفضلي يا أختي الكريمة :)#include <iostream>#include <conio.h>using namespace std; // Array 2D by Hamza+C+Asmint main(){ char *cArray[4][2]= { {"KSA","Riyal"},{"UAE","Dirham"},{"UK","Pound"},{"USA","Dollar"} }; char cNameOrCurrency[100]; int a,b; cout<<" \n\n" " 1 - Enter country name to know its currency: \n\n\tOr\n\n" " 2 - Enter currency name to know which country it belongs to:\n\n\n" " \t ==> Your choice: "; cin>>cNameOrCurrency; for(a=0;a<4;a++) { for(b=0;b<2;b++){ if(!strcmp(cNameOrCurrency,cArray[a][b])) { if(!b) cout<<"\n\n The currency name of this counry ("<<cNameOrCurrency<<") is: "; else cout<<"\n\n The country name of this currency ("<<cNameOrCurrency<<") is: "; cout<<cArray[a][b==0?1:0]; goto found; } } } cout<<"\n\n Sorry, no results for: "<<cNameOrCurrency<< "!"; found: getch(); return 0;}إن لم تفهمي الكود فسأشرحه لك. بالتوفيق. 1 شارك هذا الرد رابط المشاركة شارك الرد من خلال المواقع ادناه