【发布时间】:2019-01-27 12:11:32
【问题描述】:
如何做到这一点
#include <stdio.h>
#include <conio.h>
main()
{
char C;
printf("R=This Program gives you some of the information of the country you entered.");
printf("Enter a Country:");
scanf("%c", &C);
switch(C)
{
case 'Algeria':
printf("Capital: Algiers");
printf("Currency and Country Code: Algerian Dinar (DZD)");
break;
}
getch ();
return 0;
}
错误是
11 8 C:\Users\Edrian\Desktop\C++ Codes\World Information.cpp [警告] 字符常量对于它的类型来说太长了
C:\Users\Edrian\Desktop\C++ Codes\World Information.cpp 在函数'int main()'中:
11 8 C:\Users\Edrian\Desktop\C++ Codes\World Information.cpp [警告] 案例标签值超过
的最大值 输入
【问题讨论】:
-
提醒:
char或 字符 是单个、一个、字母或符号。 string 是零个或多个字符。switch适用于单个个字符。
标签: c++