Test_1
#include <iostream>
using namespace std;
int main() //更新为了避免重名
{
std::cout << "hello,world" << std::endl;
}
Test_2
using namespace std;
int a, b;
std::cout << "Enter a: " << std::endl;
cin >> a;
std::cout << "Enter b: " << std::endl;
cin >> b;
std::cout << "The big one is "<<(a > b ? a : b) << std::endl;
return 0;
Test_3
#include <iostream>
int main()
{
using namespace std;
int a[3] = { 1,2,3 };
string b[3] = { "aaa","bbb","ccc" };
std::cout << a[0] + a[1] + a[2] << std::endl;
std::cout << b[0] + b[1] + b[2] << std::endl;
}
Test_4
#define _CRT_SECURE_NO_WARNING
#include <iostream>
#include <string>
#include <cstring> //C-style string available
int main()
{
using namespace std;
string a[3] = { "abc","bca"};
//a是个对象strcpy strcat不可用
std::cout << a[0].size() << std::endl; //3
char piapia[20] = "fuck";
char hiahia[20];
strcpy(hiahia, piapia);
strcat(hiahia, "wdnmd");
//傻逼数组随便用
std::cout << hiahia << std::endl; //fuckwdnmd
std::cout << strlen(hiahia) << std::endl; //9
}
Test_5
#define _CRT_SECURE_NO_WARNING
#include <iostream>
#include <string>
#include <cstring>
int main()
{
using namespace std;
char charr[20];
cin.getline(charr, 20);
cout << charr << endl;
}