#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. JAVA,字符串替换

    package l515; //例5.15 //字符串替换 public class NewStr { public static void main(String[] args) { String ...

  2. 使用python调用shell判断当前进程是否存在

    使用subprocess模块判断当前进程是否存在 #! /usr/bin/env python import subprocess res = subprocess.Popen(r'ps -ef |g ...

  3. 绘制ROC曲线

    什么是ROC曲线 ROC曲线是什么意思,书面表述为: "ROC 曲线(接收者操作特征曲线)是一种显示分类模型在所有分类阈值下的效果的图表." 好吧,这很不直观.其实就是一个二维曲线 ...

  4. KnockoutJs学习笔记(三)

    之前的文章主要针对的是单一的observable(即便是observableArray也是一种observable),而文档Using computed observables则主要是针对ko.com ...

  5. jquery表单提交的新写法

    $('form').submit()和$("form").submit() 这两种都可以实现form表单的提交 jquery中$('form').submit()和$(" ...

  6. ThreadLocal详解,ThreadLocal源码分析,ThreadLocal图解

    本文脉路: 概念阐释 ---->  原理图解  ------> 源码分析 ------>  思路整理  ----> 其他补充. 一.概念阐述. ThreadLocal 是一个为 ...

  7. window.open跳过浏览器拦截

    转自https://www.cnblogs.com/shizk/p/8458916.html $('#btn').click(function () { //打开一个不被拦截的新窗口 var newW ...

  8. linux服务器查看tcp链接shell

    netstat -nt |awk '{++S[$NF]} END {for (a in S ) print a,S[a]}'

  9. 10个财务工作中常用的 Excel 万能公式

    1.多条件判断公式 =IF(AND(条件1,条件2...条件n),同时满足条件返回的值,不满足条件返回的值) =IF(OR(条件1,条件2...条件n),同时满足任一条件返回的值,不满足条件返回的值) ...

  10. JMeter实现登录初始化(类似LR的init函数功能实现)

    1.项目背景 在做项目的性能测试过程中,发现系统的登录功能非常慢,所以,在涉及到登录才能操作的场景,尽量避开登录操作 解决方案: 首选设置“登录并生成签名值”线程组