輸出結果第二個數報錯
為什么輸出的是90,25775849394
而不是90,98呀?
#include<stdio.h>
struct Student
{
? ? int math;
? ? int English;
};
int main()
{
? ? struct Student s[50];
? ? s[49].math=90;
? ? s[49].English=98;
? ? printf("%d,%d\n",s[49]);
? ? return 0;
}
為什么輸出的是90,25775849394
而不是90,98呀?
#include<stdio.h>
struct Student
{
? ? int math;
? ? int English;
};
int main()
{
? ? struct Student s[50];
? ? s[49].math=90;
? ? s[49].English=98;
? ? printf("%d,%d\n",s[49]);
? ? return 0;
}
2022-09-10
舉報
2023-03-11
c++是沒有print的!你應該是學過python的,python用的是print;而c++用的是cout。
如果想要運行,printf("%d,%d\n",s[49]);應該改為:
cout << s[49];或 cout << s[49] << endl; 或cout << s[49] << " ";
第一個是語句結束沒有任何其它內容,第二個是語句結束后換行,最后一個是空格
2022-09-18