#include
#define X 10
#define B "booboo"
int main()
{
int age;
int xp;
char name[40] = {0};
printf("please enter your first name");
scanf_s("%s",name);
printf("All right ,%s, what's your age?\n",name);
scanf_s("%d",&age);
xp = age + X;
printf("That's a %s! you must be at least %d.\n",B,xp);
return 0;
}
名字打印不出來,也沒有辦法輸入年齡
我有截圖,可是放不上來,我已經把問題放到百度上,那裡有我程序運行的截圖
http://zhidao.baidu.com/question/434419977088948684.html
我使用的是vs2015
如果使用scanf_s,應該這樣:
scanf_s("%s",name,40);表示最多讀入40個字符