#include <iostream>
#include <cstring>
#include <string>
using namespace std;
struct stu
{
string id;
int age;
};
void fun(int &a) {
a++;
}
int main()
{
stu a[10];
const int c = 10;
int a = 10;
fun(a);
cout << a << endl;
int n;
cin >> n;
cout << "Hello World!" << n << "\n";
cout << "Hello World!" << n << endl;
std::cin >> n;
std::cout << "苏胜是帅B" << endl;
for (int i = 0; i < 3; i++)
{
cout << i;
}
bool flag1 = true;
bool flag2 = 3;
bool flag3 = 0;
cout << flag1 << flag2 << flag3 << endl;
string s = "okk";
string s2 = "!!!";
string s3 = s + s2;
cout << s3 << endl;
string s4;
getline(cin,s4);
cout << s4;
string s5 = "helloworld";
cout << s5.substr(0, 1)<<endl;
}
```cpp
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include<unordered_set>
using namespace std;
int main()
{
unordered_map <string, int> unmap;
return 0;
}
void queue_fun(){
queue <int> line;
line.push(1);
}
void stack_fun(){
stack <int> s;
s.push(1);
s.push(2)
s.pop();
return 0;
}
void map_fun() {
map <string, int> m;
m["hello"] = 1;
m["world"] = 2;
cout << "hello:" << m["hello"] << endl;
for (auto p = m.begin(); p != m.end(); p++)
{
cout << p->first << ":" << p->second << endl;
}
}
void set_fun() {
vector <int> v(10);
vector <int> v1(10, 2);
vector <int> v3(10);
v3.resize(13);
cout << v3.size() << endl;
for (auto p = v3.begin(); p != v3.end(); p++) {
cout << *p << "\t";
}
cout << endl;
cout << v.size() << endl;
for (int i = 0; i < v.size(); i++)
{
v[i] = i;
cout << v[i] << "\t";
}
cout << endl;
v.push_back(11);
for (int i = 0; i < v.size(); i++)
{
cout << v[i] << "\t";
}
cout << endl;
set <int> s;
s.insert(1);
s.insert(2);
s.erase(1);
cout << (s.find(1) != s.end()) << endl;
}
}
#include <iostream>
#include <bitset>
#include <algorithm>
#include <vector>
#include <cctype>
#include <string>
using namespace std;
bool cmp(int x, int y) {
return x > y;
}
int main()
{
int a[5] = {1};
for (auto i:a) {
cout << i << "\t";
}
cout << endl;
int str_i = stoi("123");
cout << str_i << endl;
string s = to_string(123);
cout << s << endl;
}
void str_fun() {
char c = 'A';
cout << "C:" << c << endl;
cout << "判断是不是字母" << isalpha(c) << endl;
cout << "判断是不是大写" << isupper(c) << endl;
cout << "判断是不是小写" << islower(c) << endl;
cout << "判断是不是数字" << isalnum(c) << endl;
cout << "判断是不是space,\\t \\n \\" << isspace(c) << endl;
cout << (char)tolower(c) << endl;
}
void sort_fun() {
vector <int> m(10);
bool flag = false;
for (int i = 0; i < 10; i++)
{
m[i] = -i;
}
for (auto p = m.begin(); p != m.end(); p++)
{
cout << *p << "\t";
}
cout << endl;
sort(m.begin(), m.end(), cmp);
for (auto p = m.begin(); p != m.end(); p++)
{
cout << *p << "\t";
}
}
void bitset_fun() {
bitset <5> b(19);
cout << b << endl;
bitset <5> b1("11");
cout << b1 << endl;
cout << "any() b1是不是存在1 " << b1.any() << endl;
cout << "none() b1是不是不存在1 " << b1.none() << endl;
cout << "count() b1中1的个数" << b1.count() << endl;
cout << "size() b1中的大小" << b1.size() << endl;
cout << "test() b1中选中下标的位置是不是1 " << b1.test(2) << endl;
cout << b1.flip() << endl;
cout << b1.flip(1) << endl;
unsigned long a = b.to_ullong();
cout << a << endl;
std::cout << "Hello World!\n";
string str = "0110101";
bitset <5> b3(str, 2, 5);
bitset <5> b4("01101");
cout << b3 << endl;
cout << b4 << endl;
}