#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. vsftp日志xferlog格式分析

    vsftp日志xferlog格式分析 [日期:2014-06-25] 来源:Linux社区  作者:Linux [字体:大 中 小]   1.开始vsftp记录日志.修改/etc/vsftpd/vsf ...

  2. 加密算法之非对称加密RSA

    一:非对称加密的由来 RSA公钥加密算法是1977年由Ron Rivest.Adi Shamirh和LenAdleman在(美国麻省理工学院)开发的.RSA取名来自开发他们三者的名字.RSA是目前最有 ...

  3. UE4 UPROPERTY UFUNCTION

    http://blog.csdn.net/sinat_27456831/article/details/52800514

  4. Dubbo 服务集群容错配置

    Dubbo集群容错是靠配置cluster属性来做 支持改属性的标签为<dubbo:service>,<dubbo:referece>,<dubbo:consumer> ...

  5. [转] 对Array.prototype.slice.call()方法的理解

    在看别人代码时,发现有这么个写法:[].slice.call(arguments, 0),这到底是什么意思呢? 1.基础 1)slice() 方法可从已有的数组中返回选定的元素. start:必需.规 ...

  6. 选择结构switch

    1.选择结构switch switch 条件语句也是一种很常用的选择语句,它和if条件语句不同,它只能针对某个表达式的值作出判断,从而决定程序执行哪一段代码.例如,在程序中使用数字1~7来表示星期一到 ...

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

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

  8. 排查Linux机器是否已被入侵

    来自--马哥Linux运维 1.入侵者可能会删除机器的日志信息 ,可以查看日志信息是否存在后者被清除 [root@zklf-server02 ~]# ll -h /var/log/ total 3.4 ...

  9. Codeforces 922F Divisibility 构造

    Divisibility 我们考虑删数字 首先我们可以发现有一类数很特殊就是大于 n / 2的素数, 因为这些素数的贡献只有1, 并且在n大的时候, 这些素数的个数不是很少, 我们可以最后用这些数去调 ...

  10. Flask--第三个例子,写一个接口,该接口返回html前端页面,模板的使用

     将接口数据返回至html前端页面有两种方法 方法一: 1 @app.route('/index',methods=['get']) 2 def open_index(): 3 page=open(' ...