![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
芬达味的cola
一起学习!
展开
-
C++学习——嵌套结构体
#include <iostream>#include <string>using namespace std;//学生结构体struct student { string name; int score = 0;};//老师结构体(嵌套学生结构体)struct teacher { string name; struct student stu[2];};//自定义函数,用来输入信息void AllocateSpace(struct...原创 2020-07-25 11:06:45 · 1046 阅读 · 0 评论 -
C++学习——打开文件
编写一个程序,他打开一个文件,逐个字符地读取该文件,直到到达文件末尾,然后指出该文件中包含多少个字符。#include <iostream>#include <fstream>#include <cstdlib>int main(){ using namespace std; ifstream inFile; //声明一个ifstream对象,用法相当于cin inFile.open("wangke.txt"); //打开文件 .原创 2020-07-22 18:47:00 · 453 阅读 · 0 评论 -
C++学习——循环语句、分支语句
编写一个程序,读取键盘输入,直到遇到@符号为止,并回显输入(数字除外),同时将大写字符改为小写,小写字符改为大写,使用cctype函数系列 。#include <iostream>#include<cctype>int main(){ using namespace std; cout << "直到输出@符号停止:\n"; char ch; cin.get(ch); while (ch!='@') { if (isdigit(ch)) {原创 2020-07-22 16:36:33 · 96 阅读 · 0 评论 -
C++学习——结构体(基于VS)
题目:有4个学生,每个学生数据包括学号,姓名,英语,数学,物理三门课的成绩,从键盘输入4个学生的数据,要求打印出3门课程的总平均成绩,以及最高分的学生的数据(包括学号、姓名、3门课的成绩,平均分数)#include <iostream>#include <string>using namespace std;struct student { string Stu_id; string Stu_name; float English; float Math;原创 2020-06-29 22:16:32 · 482 阅读 · 0 评论