编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习1
#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的更多相关文章
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9
#include <iostream> #include <fstream> #include <cstdlib> #include <string> ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8
#include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7
#include <iostream> #include <string> #include <cctype> using namespace std; int m ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6
#include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5
#include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4
#include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showm ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3
#include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2
#include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int mai ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习1
#include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=c ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习9
#include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of ...
随机推荐
- HDU 4763 Theme Section(KMP灵活应用)
Theme Section Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) To ...
- WPF:如何高速更新Model中的属性
原文:[WPF/MVVM] How to deal with fast changing properties In this article, I will describe a problem w ...
- Win8.1 查看 “Windows 体验指数“
啥是 Windows 体验指数 ? 引用MS的介绍: http://windows.microsoft.com/zh-cn/windows7/products/features/windows-exp ...
- Google搜索
https://www.google.com/intl/br/insidesearch/tipstricks/all.html 如何用好谷歌等搜索引擎?
- [转]Xshell在按delete,backspace键产生乱码(不可用)的解决方法
Xshell在按delete,backspace键产生乱码的解决方法 当我们用Xshell登录进入linux后,在普通模式下,对输入进行删除等操作没有问题. 而在运行中,按delete,backspa ...
- 一起学Hadoop——MapReduce原理
一致性Hash算法. Hash算法是为了保证数据均匀的分布,例如有3个桶,分别是0号桶,1号桶和2号桶:现在有12个球,怎么样才能让12个球平均分布到3个桶中呢?使用Hash算法的做法是,将1 ...
- Python学习(十四) —— 并发编程
一.进程的概念 进程即正在执行的一个过程,进程是对正在运行的程序的一个抽象. 进程的概念起源于操作系统,是操作系统最核心的概念.操作系统的其它所有内容都是围绕进程的概念展开的. #必备的理论基础 #一 ...
- BZOJ2821 作诗(Poetize) 主席树 bitset
原文链接https://www.lydsy.com/JudgeOnline/problem.php?id=2821 题目传送门 - BZOJ2821 题意 $n$ 个数,$m$ 组询问,每次问 $[l ...
- HDU3488 Tour KM
原文链接http://www.cnblogs.com/zhouzhendong/p/8284304.html 题目传送门 - HDU3488 题意概括 给一个n的点m条边的有向图. 然后让你把这个图分 ...
- 如何在不使用try语句的情况下查看文件是否存在
如果你要确定文件存在的话然后做些什么,那么使用try是最好不过的 如果您不打算立即打开文件,则可以使用os.path.isfile检查文件 如果path是现有常规文件,则返回true.对于相同的路径, ...