Compare commits
7 Commits
62f9137098
...
dev_jiaolo
| Author | SHA1 | Date | |
|---|---|---|---|
| 71f12730cc | |||
| c69029e578 | |||
| 2ed493d32f | |||
| b824e76a0c | |||
| 397c928058 | |||
| fae2ab8977 | |||
|
|
f40d0d67f3 |
18
c++常量类型的确定.cpp
Normal file
18
c++常量类型的确定.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Created by violet on 2026/2/24.
|
||||
//
|
||||
#include "iostream"
|
||||
#include "windows.h"
|
||||
int main() {
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
long long int i1 = 2212345678;
|
||||
std::cout<<sizeof(i1)<<i1<<std::endl;
|
||||
char a = 3;
|
||||
char b = 32;
|
||||
char c = 16;
|
||||
char d = 17;
|
||||
char e = '5';
|
||||
char f = 126;
|
||||
std::cout << f << std::endl;
|
||||
std::cout <<c<<a<<b<<d<<e<<std::endl;
|
||||
}
|
||||
10
cin数据输入.cpp
Normal file
10
cin数据输入.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
//
|
||||
// Created by viole on 2026/2/25.
|
||||
//
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main() {
|
||||
int num ;
|
||||
cin >> num;
|
||||
cout << num << endl;
|
||||
}
|
||||
14
字符串.cpp
Normal file
14
字符串.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
//
|
||||
// Created by violet on 2026/2/24.
|
||||
//
|
||||
#include <iostream>
|
||||
namespace std {
|
||||
int x =1;
|
||||
}
|
||||
int main() {
|
||||
int a = 1;
|
||||
auto b = std::x+1;
|
||||
std::cout <<b<< std::endl;
|
||||
return 0;
|
||||
}
|
||||
15
字符串拼接.cpp
Normal file
15
字符串拼接.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by viole on 2026/2/24.
|
||||
//
|
||||
#include "iostream"
|
||||
using namespace std;
|
||||
int main() {
|
||||
string a = "1";
|
||||
string b = "12";
|
||||
string c = "13";
|
||||
string d = "14";
|
||||
int e = 12;
|
||||
cout << a+b<<c+d<<a+to_string(e)<< endl;
|
||||
bool b1 = true;
|
||||
return 0;
|
||||
}
|
||||
22
实型数据类型.cpp
Normal file
22
实型数据类型.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Created by viole on 2026/2/24.
|
||||
//
|
||||
#include "iostream"
|
||||
#include "windows.h"
|
||||
using namespace std;
|
||||
int main() {
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
//float 单精度浮点数,4字节,6-7位的有效位数
|
||||
float num1 = 1234567890;
|
||||
float num2 = 1.234567890;
|
||||
double num3 = 1234567890.1234567890;
|
||||
long double num4 = 1234567890.1234567890;
|
||||
cout<<fixed;
|
||||
cout.width(20);
|
||||
cout<<num1<<endl;
|
||||
cout<<num2<<endl;
|
||||
cout<<sizeof(num2)<<endl;
|
||||
cout<<num3<<","<<sizeof(num3)<<endl;
|
||||
cout<<num4<<","<<sizeof(num4)<<endl;
|
||||
|
||||
}
|
||||
11
布尔数据类型.cpp
Normal file
11
布尔数据类型.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Created by viole on 2026/2/25.
|
||||
//
|
||||
#include "iostream"
|
||||
using namespace std;
|
||||
int main() {
|
||||
bool flag = 1;
|
||||
bool flag2 = 0;
|
||||
cout << flag << endl;
|
||||
cout << flag2 << endl;
|
||||
}
|
||||
13
转义字符.cpp
Normal file
13
转义字符.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Created by violet on 2026/2/24.
|
||||
//
|
||||
//转义字符:将普通的字符使用\作为开头,将其含义进行转换,对照得到ascii表的控制字符的功能
|
||||
//\n \t \\ \'\"
|
||||
#include "iostream"
|
||||
#include "windows.h"
|
||||
int main() {
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
std::cout<<"aa\tbbbb"<< std::endl;
|
||||
std::cout<<"aa\t\tbbbb"<<std::endl;
|
||||
std::cout<<"aa\taabbbbaabbbb"<<std::endl;
|
||||
}
|
||||
Reference in New Issue
Block a user