最新回答 / 慕函數7131464
int main(){? ?struct Student stu[50];? ?stu[20].math=50;? ?stu[20].english=50;? ?return 0;}里的?struct Student stu[50];是重新命名為stu了嗎
2022-11-13
最贊回答 / qq_幕布斯0176761
用int main時需要返回一個值,return 0;表示返回的值是0,在函數調用的時候會用到返回的值,就好比在一個函數調用的時候,return 1;則函數返回后會給主函數返回1這個值;
2022-11-10
最新回答 / qq_幕布斯0176761
#include<stdio.h>int main(int argc,char **argv){? ? int a=1;? ? int b=2;? ? int c=a+b;? ? int d=a-b;? ? int e=a*b;? ? int f=a/b;? ? int g=a%b;? ??? ? printf("%d %d %d %d %d",c,d,e,f,g);? ? return 0;}
2022-11-01
最新回答 / 慕仙4298044
共用體使用union關鍵字聲明,內部聲明的多個字段共享內存空間,共用體的占用空間與共用體內聲明的空間占用最大的類型占用空間一致,并且對齊,只能使用共用體中的一個字段(根據不同的場景使用不同類型的字段),不能同時使用共用體中多個字段。
2022-10-24
#include <stdio.h>
#include <iostream>
enum Week
{
Mon, // 星期一
Tue, // 星期二
Wed, // 星期三
Thu, // 星期四
Fri, // 星期五
Sat, // 星期六
Sun, // 星期日
};
int main(int argc,char **argv){
Week today = Week::Wed;
printf("星期 %d\n", today + 1);
return 0;
}
#include <iostream>
enum Week
{
Mon, // 星期一
Tue, // 星期二
Wed, // 星期三
Thu, // 星期四
Fri, // 星期五
Sat, // 星期六
Sun, // 星期日
};
int main(int argc,char **argv){
Week today = Week::Wed;
printf("星期 %d\n", today + 1);
return 0;
}
2022-10-19
#include <stdio.h>
#include <iostream>
int main(int argc,char **argv)
{
int a = 0;
float b = 9.5;
std::cout << a << ", " << b;
printf("a: %d, b: %f", a, b);
return 0;
}
#include <iostream>
int main(int argc,char **argv)
{
int a = 0;
float b = 9.5;
std::cout << a << ", " << b;
printf("a: %d, b: %f", a, b);
return 0;
}
2022-10-19
#include<stdio.h>
#include <iostream>
using namespace std;
int main()
{
cout <<"char "<< sizeof(char)<<endl;
cout <<"short "<< sizeof(short)<<endl;
cout <<"int "<< sizeof(int)<<endl;
cout <<"long "<< sizeof(long)<<endl;
cout <<"long long "<< sizeof(long long);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout <<"char "<< sizeof(char)<<endl;
cout <<"short "<< sizeof(short)<<endl;
cout <<"int "<< sizeof(int)<<endl;
cout <<"long "<< sizeof(long)<<endl;
cout <<"long long "<< sizeof(long long);
return 0;
}
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello World!This is C++style"<<endl;
printf("Hello World!This is C Style");
}
using namespace std;
int main()
{
cout<<"Hello World!This is C++style"<<endl;
printf("Hello World!This is C Style");
}