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

حاولت احل هذا الكود ولكن ,,,,, اارجو اللمسااعده

بدأه اشواق الحربي في 3 مايو 2014 · 4 رد · 972 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مساء اللخير

عندي مساله حاوللت احلهاا ولكن فيه شي عقدني

ممكن تسااعدوني

 

هذا السوال

 

 

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:

  1. Enter country name to  know its currency
  2. 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;
}

تم تعديل هذه المشاركة بواسطة اشواق الحربي في 4 مايو 2014 في 00:36

#2

ضعي الكود بين هذين الوسمين

[*code][*/code]

بعد مسح النجوم وذلك للتنسيق

‎لا تيأسن إذا كبوتم مرة ** إن النجاح حليف كل مثابر‎

 

Import AnyCodeYouLearned Project = findNewProjecthasProject = Truewhile (!dead&&hasProject) { codeingisDone = try_Codeif (isDone)  Project = findNewProjectelse learn_code
#3

تم

ارجو مساعدتي باسرع وقت :tbcorner:

#4

وما هى المشكلة التى تواجهك ؟؟؟ هل يعطى نتائج غير صحيحة ام انه لا يعمل من الاساس ؟؟؟؟؟


﴿وَمَا كَانَ اللَّهُ لِيُعَذِّبَهُمْ وَأَنْتَ فِيهِمْ ۚ وَمَا كَانَ اللَّهُ مُعَذِّبَهُمْ وَهُمْ يَسْتَغْفِرُونَ﴾

الأنفال ۳۳                                  
 

#5

هذا هو الحل لمعضلتك، تفضلي يا أختي الكريمة :)

#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]))                 {                     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
rS3eY.png

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…