C++primer plus第六版课后编程题答案7.8b
2014-04-10 10:47
357 查看
7.8b
vs2010不知道搞毛,居然爆了一推出错。
但是在Dev c++运行完成没问题,暂时还不知道为什么。
已经搞清楚了错误所在。
原因是:std名称空间已经有了exp这个关键词的存在!
将exp改为Exp或者
using namespace std改为
using std::cout;
using std::cin;
vs2010不知道搞毛,居然爆了一推出错。
但是在Dev c++运行完成没问题,暂时还不知道为什么。
已经搞清楚了错误所在。
原因是:std名称空间已经有了exp这个关键词的存在!
将exp改为Exp或者
using namespace std改为
using std::cout;
using std::cin;
#include <iostream> using namespace std; const int Seasons=4; const char *season[Seasons]={"Spring","Summer","Fall","Winter"}; struct exp { double ex[Seasons]; }; void fill(exp &ex); void show(const exp &ex); int main() { exp ex; fill(ex); show(ex); cin.get(); system("pause"); return 0; } void fill(exp &ex) { for(int i=0;i<Seasons;i++) { cout<<"\nEnter "<<*(season+i)<<" expenses:"; cin>>ex.ex[i]; } cout<<"Enter end!"; } void show(const exp &ex) { cout<<"\nshow start!"<<endl; for(int i=0;i<Seasons;i++) { cout<<"The "<<*(season+i)<<" expenses is "<<ex.ex[i]<<endl; } cout<<"show endl"<<endl; }
相关文章推荐
- C++primer plus第六版课后编程题答案7.8b
- C++primer plus第六版课后编程题答案16.10
- C++primer plus第六版课后编程题答案7.2
- C++primer plus第六版课后编程题答案 7.8a
- C++primer plus第六版课后编程题答案8.2
- C++primer plus第六版课后编程题答案9.2
- C++primer plus第六版课后编程题答案9.4
- C++primer plus第六版课后编程题答案11.1(已修改)
- C++primer plus第六版课后编程题答案11.2 绝世大坑
- C++primer plus第六版课后编程题答案11.4
- C++primer plus第六版课后编程题答案13.4
- C++PRIMER PLUS第六版课后编程题答案 3.1-3.7
- C++primer plus第六版课后编程题答案 7.8a
- C++primer plus第六版课后编程题答案9.4
- C++primer plus第六版课后编程题答案16.4
- C++PRIMER PLUS第六版课后编程题答案 3.1-3.7
- C++primer plus第六版课后编程题答案18.1
- C++primer plus第六版课后编程题答案
- C++primer plus第六版课后编程题答案8.8
- C++primer plus第六版课后编程题答案10.4