#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");
}
最新回答 / weixin_慕运维8149525
数组元素个数是一定要用常数,你放个变量length当然不行,你如果有教材的话可以去看人家在写的时候是不是用const定义了一个符号常量?你在定义length时可以写 const int length=100;,这时length就是一个常量,就可以用了。但是,还要注意:既然length成为了常量,下面的代码中就不能改变它的值了。
2022-09-24
最新回答 / qq_慕慕6286932
应该是的,数组赋值可以一开始就其赋值,如: int arr[4] = {1, 2, 3, 4};也可以先声明数组,再将其赋值,如:<...code...>所以数组赋值是有顺序的<...code...><...code...>
2022-09-19
最赞回答 / weixin_慕尼黑2406156
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-10