c++程式不知道怎麼改

#include <iostream>

using std::cin;

using std::cout;

using std::endl;

int main()

{

int Month;

cout << "\n"

<< "請輸入1至5任一數字 : " << endl;

cin >> Month;

if (Month < 1 || Month >5)

{

cout << "您輸入的數字沒有意義!";

goto EndofProgram;

}

cout << "\n" << Month << "的英文稱呼是";

switch ((Month%5)/4)    <<- *** 這一行好像有錯誤***

{

case 0:

cout << "one"<< endl;

break;

case 1:

cout << "tow"<< endl;

break;

case 2:

cout << "three"<< endl;

break;

case 3:

cout << "four"<< endl;

break;

case 4:

cout << "five"<< endl;

break;

default:

cout << "程式有問題!" << endl;

}

EndofProgram:

return 0;

}

輸入1~5數字,對應出英文名稱

程式跑起來怪怪的

請各位大大幫我看看怎麼改  

謝謝了!!

2 Answers

Rating
  • 1 decade ago
    Best Answer

    switch (Month-1)

    這樣就好了

  • Anonymous
    1 decade ago

    goto......建議不要用,

    另外,using std::cin;

    using std::cout;

    using std::endl;

    改用using namespace std;

    就好了~

    其他,就不說了......

Still have questions? Get your answers by asking now.