随笔分类 - C++
摘要:#include <iostream> using namespace std; int main() { //1.单精度 float //2.双精度 double //默认情况下,输出一个小数,会显示出6位有效数字 float f1 = 3.14f; double d1 = 3.1415926;
阅读全文
摘要:#include <iostream> using namespace std; int main() { //整型shaort(2),int(4),long(4),long long(8) //可以利用sizeof求出数据类型占用的内存大小; //语法:sizeof(数据类型或变量) short
阅读全文
摘要:#include <iostream> using namespace std; int main() { //整型 //1.短整型short (-32768 到 32767) short num1 = 10; //2.整型int (-2147483648 到 2147483647) int num
阅读全文
摘要:#include <iostream> using namespace std; //标识符命名规则 //1.标识符不可以是关键字 //2.标识符是由字母,数字,下划线构成 //3.标识符第一字符只能是字母或下划线 //4.标识符是区分大小写的 int main() { //1.标识符不可以是关键字
阅读全文
摘要:#include <iostream> using namespace std; int main() { //int int = 10; 错误,第二个int 是关键字,不能关键字做变量常量 system("pause"); return 0; }
阅读全文
摘要:#include <iostream> using namespace std; //常量的定义方式 //1.#define宏常量 //2.const修饰的变量 //1.#define宏常量 #define Day 7 int main() { //2.const修饰的变量 const int mo
阅读全文
摘要:#include <iostream> using namespace std; int main() { //变量的创建语法:数据类型 变量名=变量初始值 int num=10;//创建一个整数变量num,并且把10赋值给这个变量 cout<<num<<endl;//输出变量num的值 syste
阅读全文
摘要:#include <iostream> using namespace std; //1.单行注释 // //2.多行注释 /* main是程序的入口, 每个程序都必须有一个 */ int main() { //11行在屏幕输出helloword cout << "helloword" << end
阅读全文
摘要:#include <iostream> using namespace std; int main() { cout<<"hello word"<<endl; system("pause"); return 0; }
阅读全文
摘要:// MFCtestDlg.cpp: 实现文件 // #include "pch.h" #include "framework.h" #include "MFCtest.h" #include "MFCtestDlg.h" #include "afxdialogex.h" #ifdef _DEBUG
阅读全文
摘要:#include <iostream> using namespace std; int main() { short n_short = SHRT_MAX; int n_int = INT_MAX; long n_long = LONG_MAX; long long n_llong = LLONG
阅读全文
摘要:#include <iostream> int DayTosecond(int day); int main() { using namespace std; int day; cout << "请输入天数" << endl; cin >> day; cout << day << "天有" << D
阅读全文
摘要:#include <iostream> #include <cmath> void simon(int n);//函数声明 int main(void) { using namespace std; int n; cout << "请输入小狗个数" << endl; cin >> n; simon(
阅读全文
摘要:#include <iostream> //预处理器编译指令#include #include <cmath> int main(void) //函数头 { //函数体开始{ using namespace std; //编译指令 double area; cout << "输入房屋的平方" <<
阅读全文
摘要:#include <iostream> //预处理器编译指令#include int main(void) //函数头 { //函数体开始{ using namespace std; //编译指令 int apple; //声明整数变量 cout << "你现在有多少个苹果" << endl; ci
阅读全文
摘要:#include <iostream> //预处理器编译指令#include int main(void) //函数头 { //函数体开始{ using namespace std; //编译指令 int apple; //声明整数变量 apple = 25; //赋值变量 cout << "我有"
阅读全文
摘要:#include <iostream> //预处理器编译指令#include int main(void) //函数头 { //函数体{ using namespace std; //编译指令 cout << "你好"; //语句 cout<<endl; //换行 cout << "欢迎学习C++"
阅读全文
摘要:/// <summary> /// 判断是否重复运行 /// </summary> /// <returns></returns> BOOL IsAlreadyRun() { HANDLE hMutex = NULL; hMutex = ::CreateMutex(NULL, FALSE, "TES
阅读全文

浙公网安备 33010602011771号