輸出結(jié)果第二個數(shù)報錯
為什么輸出的是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的!你應(yīng)該是學(xué)過python的,python用的是print;而c++用的是cout。
如果想要運行,printf("%d,%d\n",s[49]);應(yīng)該改為:
cout << s[49];或 cout << s[49] << endl; 或cout << s[49] << " ";
第一個是語句結(jié)束沒有任何其它內(nèi)容,第二個是語句結(jié)束后換行,最后一個是空格
2022-09-18