- ibrahim sherif mohamedمبرمج جديد
- Posts : 9
Points : 1046
Reputation : 0
Join date : 11/08/2020
[تم الحل]enumeration type function doesn't work
السبت أغسطس 22, 2020 1:27 pm
- الكود:
#include <iostream>
using namespace std;
flowerType readIn();
int main()
{
enum flowerType {ROSE, DAISY, CARNATION, FREESIA};
readIn ();
return 0;
}
flowerType readIn()
{
string str;
flowerType flower = 0;
cin >> str;
if (str == "Rose")
flower = ROSE;
else if (str == "Daisy")
flower = DAISY;
else if (str == "Carnation")
flower == CARNATION;
else if (str == "Freesia")
flower = FREESIA;
else
cout << "Invalid flower name." << endl;
return flower;
}
- ibrahim sherif mohamedمبرمج جديد
- Posts : 9
Points : 1046
Reputation : 0
Join date : 11/08/2020
رد: [تم الحل]enumeration type function doesn't work
السبت أغسطس 22, 2020 1:31 pm
رد: [تم الحل]enumeration type function doesn't work
الثلاثاء أغسطس 25, 2020 9:57 pm
حضرتك معرف enum داخل main وده مينفعش.. عرفها فوق
- ibrahim sherif mohamedمبرمج جديد
- Posts : 9
Points : 1046
Reputation : 0
Join date : 11/08/2020
رد: [تم الحل]enumeration type function doesn't work
الثلاثاء سبتمبر 01, 2020 4:43 pm
تم الحل, شكرا
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى