#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
struct patron
{
double mon;
string name;
};
int main()
{
int num,count1=0,count2=0;
ifstream fin;
char filename[20];
cout<<"Enter name of data file: ";
cin.get(filename,20);
fin.open(filename);
if(!fin.is_open())
{
cout<<"Could not to open the file "<<filename<<endl;
cout<<"Program termination.\n";
exit(EXIT_FAILURE);
}
fin>>num;
fin.get();
patron *newp=new patron[num];
for(int i=0;i<num;i++)
{
getline(fin,newp[i].name);
fin>>newp[i].mon;
fin.get();
}
cout<<"Grand Patrons:\n";
for(int j=0;j<num;j++)
{
if(newp[j].mon>10000)
{
cout<<newp[j].name<<":"<<newp[j].mon<<endl;
count1++;
}
if(count1==0)
cout<<"none\n";
cout<<"Patrons:\n";
for(int k=0;k<num;k++)
{
if(newp[k].mon<=10000)
{
cout<<newp[k].name<<":"<<newp[k].mon<<endl;
count2++;
}
}
if(count2==0)
cout<<"none\n";
}
delete [] newp;
system("pause");
return 0;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

随机推荐

  1. jQuery mouse and lunbo

    自动轮播 和 鼠标事件var arr = ["images/d.jpg", "images/q.jpg", "images/c.jpg", ...

  2. 记事本:一些js案例以及DOM和BOM

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. Mybatis操作oracle数据库的一些坑

    oracle区分大小写,如果不想区分,必须要用引号包住 使用mybatis的generator生成的时候,建议使用全大写表,中间用下划线隔开,会生成驼峰字段 oracle没有空字符串的概念 写myba ...

  4. windows 安装docker报错:Error checking TLS connection: ssh command error: command : ip addr show

    今天安装docker部署的时候总是再报这个错误. 报错的原因是初始化的时候出错了. 在docker 安装目录下有一个文件,如下图所示 将它复制到你电脑用户名目录下生成.docker 的文件夹中,如下图 ...

  5. Nginx动态路由的新姿势:使用Go取代lua

    导语: 在Nitro 中, 我们需要一款专业的负载均衡器. 经过一番研究之后,Mihai Todor和我使用Go构建了基于Nginx.Redis 协议的路由器解决方案,其中nginx负责所有繁重工作, ...

  6. IE8引用jQuery报$或者jQuery未定义

    最近公司做的项目要求兼容到IE8,结果在页面调试的时候出了个bug,在IE8上面一直报错$未定义,或者jQuery未定义,导致页面上面写的jQuery全部失效,在Chrome浏览器没有任何问题.很是头 ...

  7. Scyther 论文相关资料整理

    1.Scyther 的特点使用方法 Scyther可以提供轨迹的简单描述,方便分析协议可能出现的攻击和表现,使用Athena算法,该软件表现如下特点: 该软件有明确的终止,能工提供无限会话协议安全性的 ...

  8. MySQL 慢查询日志分析工具(pt-query-digest)

    1. 慢查询命令: 是否开启和日志路径:show variables like '%slow_query_log%'; 最大查询时间:show variables like '%query_time% ...

  9. 2018年冬季寒假作业4--PTA 抓老鼠啊~亏了还是赚了?

    1. 实验代码; #include<stdio.h> ; void search(char a,int *p){ if(a=='X'){ ) *p=; ; printf("U&q ...

  10. 用vue实现点击编辑按钮将li变为可以输入文本的input

    <template> <li v-if='flag'><span @click='edit()'>点击一下</span></li> < ...