#include <iostream>
//#include <string>
using namespace std;
struct stu
{
 char fname[10];//这里若用string fname
 char lname[10];//同样这里若用string lname
 char grade;
 int age;
};
int main()
{
 stu stu1;
 cout<<"What is first name? ";
 cin.getline(stu1.fname,10);//getline(cin,stu1.fname)存在输入两次enter,才会运行到下一句cout<<"What...",??
out<<"What is your last name? ";
 cin.getline(stu1.lname,10);
 cout<<"What letter grade you deserve? ";
 cin>>stu1.grade;
 cout<<"What is your age? ";
 cin>>stu1.age;
 cout<<"Name: "<<stu1.fname<<", "<<stu1.lname<<endl;
 cout<<"Grade: "<<(char) (stu1.grade+1)<<endl;
 cout<<"Age: "<<stu1.age<<endl;
 system("pause");
 return 0;
}

编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习1的更多相关文章

  1. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9

    #include <iostream> #include <fstream> #include <cstdlib> #include <string> ...

  2. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8

    #include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...

  3. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7

    #include <iostream> #include <string> #include <cctype> using namespace std; int m ...

  4. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6

    #include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...

  5. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5

    #include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...

  6. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4

    #include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showm ...

  7. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3

    #include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter ...

  8. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2

    #include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int mai ...

  9. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习1

    #include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=c ...

  10. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习9

    #include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of ...

随机推荐

  1. SQLSERVER 数据量太大,重启服务器后,数据库显示正在恢复

    问题:如题. 解决方法:右键数据库   属性——选项——恢复模式:简单

  2. mysql查看工具——mysql profiler sql

    http://www.profilesql.com/download/ 开发同学的福利--mysql监控工具sqlprofiler,类似sqlserver的profiler工具 https://www ...

  3. Context连接和断开的情况下的CRUD操作

    连续情况下的CRUD操作是一项相当容易的任务,因为默认情况下,上下文会自动跟踪实体在其生命周期中发生的更改,AutoDetectChangesEnabled为true. 以下示例显示如何添加,更新和删 ...

  4. Centos7编译安装GCC7.2

    通常编译的时候可能需要新版本的gcc,本文就说明下基于低版本的gcc升级为gcc7.2 wget 'http://mirrors-usa.go-parts.com/gcc/releases/gcc-7 ...

  5. net core体系-web应用程序-2项目简单案例

    阅读目录   NO1 留言板(mysql的使用) NO2 聊天室(WebSocket的使用) NO3 找工作(AngleSharp的使用) 部署多个站点 一些其它的细节 部署阿里云 mysql的客户端 ...

  6. java读取配置文件方法以及工具类

    第一种方式 : java工具类读取配置文件工具类 只是案例代码  抓取异常以后的代码自己处理 import java.io.FileNotFoundException; import java.io. ...

  7. TFTP Server的搭建和使用(Fedora)

    一.tftp服务的安装 yum install xinetd tftp tftp-server 表示我安装的已经是最新版本的tftp服务了,不用更新了. 二.配置tftp服务的相关参数(没有就创建新的 ...

  8. 初窥Java之二

    一.java中存在三大注释: 第一大注释:  单行注释   一般用于信息量比较少的地方 第二大注释:  多行注释   一般用于信息比较多的地方 多行注释注意事项:1.多行注释的开始行与结尾行不能写注释 ...

  9. NSL:SOFM神经网络实现预测哪个样本与哪个样本处在同一层,从而科学规避我国煤矿突水灾难—Jason niu

    load water_data.mat attributes = mapminmax(attributes); P_train = attributes(:,1:35); T_train = clas ...

  10. 【官档整理】Visual Studio 2017 VS2017 中文离线安装包下载

    [官档整理]Visual Studio 2017 VS2017 中文离线安装包下载 转 https://blog.csdn.net/fromfire2/article/details/81104648 ...