#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. HDU5950 Recursive sequence (矩阵快速幂)

    Recursive sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Other ...

  2. github.com加速节点

    github.com加速节点 192.30.253.118 github.com192.30.253.119 github.com93.46.8.89 github.com

  3. win10下右键菜单添加“打开cmd”

    早期版本的win10是可以在文件夹的左上角打开cmd的,更新后发现现在只有powershell能用了.这不方便. 通过修改注册表,可以实现这个功能. 具体做法:新建一个.reg文件win10_add_ ...

  4. Aho-Corasick算法实现(简单关键字过滤)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...

  5. [转] mongoDB与mongoose

    mongoDB简介 mongoDB与一些关系型数据库相比,它更显得轻巧.灵活,非常适合在数据规模很大.事务性不强的场合下使用.同时它也是一个对象数据库,没有表.行等概念,也没有固定的模式和结构,所有的 ...

  6. Java基础知识➣发送Emai和访问MySQL数据库(七)

    概述 Java程序发送 E-mail 十分简单,但是首先你应该在你的机器上安装 JavaMail API 和Java Activation Framework (JAF) .Java访问数据则需要 使 ...

  7. 【BZOJ2560】串珠子

    题解: 跟n个点有标号的无向连通图个数几乎一模一样 直接上代码了 代码: #include <bits/stdc++.h> using namespace std; #define ll ...

  8. UICollectionViewController的用法1

    UICollectionView 和 UICollectionViewController 类是iOS6 新引进的API,用于展示集合视图,布局更加灵活,可实现多列布局,用法类似于UITableVie ...

  9. Python自带IDE设置字体

    打开Python 3.7.0 shell 点击菜单项 “”Options“”>"Configure IDLE" 可选择窗口的字体和大小 可选择背景主题颜色 可自定义配置

  10. maven pom.xml(公司版)

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...