范例:存款复利计算器
摘要:#include<iostream> using namespace std; int main() { double r,m,y; cout << "***** 复利计算器 ****"<< endl; cout << "银行年利率:(%)" ; cin >> r; cout << "\r\n资金数
阅读全文
posted @
2022-09-01 11:49
RicLiu
阅读(93)
推荐(0)
c++的类型转换
摘要:1.int转string,函数to_string() x=10; string m=to_string(x); 经测试gcc v5.4.0版本不支持,版本v7.5.0支持。判断版本号命令:g++ -v 同样适用于double,float 2.string转int,函数atoi() string i=
阅读全文
posted @
2022-09-01 10:50
RicLiu
阅读(26)
推荐(0)
c++常用函数
摘要:1.变量类型判断函数typeid() int x=11; if(typeid(x)==typeid(int)) { cout << "int" << endl; } 可以判断int,string,double,char,Struct等类型和类 2.式样化输出函数printf() int x=11;
阅读全文
posted @
2022-09-01 10:28
RicLiu
阅读(119)
推荐(0)
一个最基本的c++程序
摘要:#include <iostream> using namespace std; int main() { cout << "ok" << endl; return 0; } 编译命令:g++ x.cpp -o m 即可生成一个m的程序,使用./m运行
阅读全文
posted @
2022-09-01 10:13
RicLiu
阅读(38)
推荐(0)
file文件读写
摘要:一、文件读取 FILE *f = fopen(addr, "rb"); // r for read, b for binary fread(pk, sizeof(pk), 1, f); fclose(f); fread()函数:从流中读取数据块 四个参数: 1.变量 2.
阅读全文
posted @
2022-09-01 10:10
RicLiu
阅读(79)
推荐(0)