i信息学奥赛

加入QQ群:1025629106,或关注微信公众号:i信息学奥赛,获取更多学习资源。

导航

随笔分类 -  C++语言基础

摘要:感谢2004郑楚煌整理提供一、定义结构体是一种把不同类型的变量打包结合成一个一个变量类型。例如,现在我们要存储多个学生的考试成绩,由姓名(string),学号(int),语文数学英语成绩(可能有小数,所以要用double),如果按照一般方法处理,我们要这样做:string name[20];int 阅读全文

posted @ 2021-01-24 19:37 shnoip

摘要:一、sscanf语句:描述:C 库函数 int sscanf(const char *str, const char *format, ...) 从字符串读取格式化输入。说明:sscanf与scanf类似,都是用于输入的,只是后者以屏幕(stdin)为输入源,前者以固定字符串为输入源。返回值:如果成 阅读全文

posted @ 2019-07-28 14:52 shnoip 阅读(350) 评论(0) 推荐(1)

摘要:感谢高安路一小陆宇昂同学提供检测鼠标坐标#include<iostream>#include<windows.h>using namespace std;int main(){ POINT p; while(1) { GetCursorPos(&p); cout<<p.x<<' '<<p.y; sy 阅读全文

posted @ 2018-04-18 18:39 shnoip 阅读(623) 评论(0) 推荐(0)

摘要:NOIP复赛文件操作参考代码 #include<cstdio> using namespace std; int main() { freopen("test.in","r",stdin); freopen("test.out","w",stdout); 解题代码…… fclose(stdin); 阅读全文

posted @ 2018-04-16 14:51 shnoip 阅读(460) 评论(0) 推荐(1)

摘要:string类型的主要函数与运算1、size()求字符串长度,等同于length()函数。例如:s="12 34";cout<<s.size();结果是:5。2、getline(cin,s)读入一整行(直到换行),包括读入空格。3、substr(开始位置i,子串长度len)取字符串的子串。当i+le 阅读全文

posted @ 2017-04-08 14:12 shnoip 阅读(1446) 评论(0) 推荐(0)

摘要:例:在屏幕上输出“Hello World!”。 #include<iostream> //使用cin,cout,须调用iostream库,否则编译出错#include<cstdlib> //使用system()调用cstdlib库using namespace std;int main(){ cou 阅读全文

posted @ 2016-12-04 08:53 shnoip 阅读(134) 评论(0) 推荐(0)