摘要: golf.h#ifndef GOLF_H_ #define GOLF_H_const int Len=40;struct golf{ char fullname[Len]; int handicap; };void setgolf(golf &g,const char *name,int hc);int setgolf(golf &g);void handicap(golf &g,int hc);void showgolf(const golf &g);#endifgolf.cpp#include #include "golf.h";#inc 阅读全文
posted @ 2014-04-12 10:41 天下纵横C++ 阅读(117) 评论(0) 推荐(0)
摘要: 对于刚学编程,刚接触C++的新手来说,编译运行报错是最头疼的一件事,爆出一堆英文,英语差一点的又不知道什么意思,所以也不知道如何去改,在此,我给大家传一份常见错误中英文对照表及简单解释,希望可以帮到大家:fatal error C1003: error count exceeds number; stopping compilation中文对照:(编译错误)错误太多,停止编译分析:修改之前的错误,再次编译fatal error C1004: unexpected end of file found中文对照:(编译错误)文件未结束分析:一个函数或者一个结构定义缺少“}”、或者在一个函数调用或表达 阅读全文
posted @ 2014-04-11 21:33 天下纵横C++ 阅读(835) 评论(0) 推荐(0)
摘要: 原来是将其他博客的内容搬到CSDN啊,我还以为是可以互相搬家的呢。我晕。 阅读全文
posted @ 2014-04-11 16:51 天下纵横C++ 阅读(96) 评论(0) 推荐(0)
摘要: 1001#include using namespace std;long int Sum(int a){ long int sum=0; for(int i=1;i>a) { cout<<Sum(a)<<endl<<endl; //cout<<Sum(b); } } 发现自己英文菜菜的,居然看错题了,还以为是两个数字一起输入的呢,真是郁闷。 阅读全文
posted @ 2014-04-11 13:05 天下纵横C++ 阅读(196) 评论(0) 推荐(0)
摘要: Problem DescriptionCalculateA + B.InputEach line will contain two integersAandB. Process to end of file.OutputFor each case, outputA + Bin one line.Sample Input1 1Sample Output2AuthorHDOJRecommendWe have carefully selected several similar problems for you:10011089100210901091#include using namespace 阅读全文
posted @ 2014-04-11 00:06 天下纵横C++ 阅读(247) 评论(0) 推荐(0)
摘要: 现在开始逐渐地学一点关于ACM的东西。慢慢地把自己的算法能力提高上去。坚持每天做几道题。都用C++解决。Love if! 阅读全文
posted @ 2014-04-10 23:59 天下纵横C++ 阅读(109) 评论(0) 推荐(0)
摘要: 8.8#include using namespace std;template T SumArray(T arr[],int n){ T sum=0; for(int i=0;iT SumArray(T *arr[],int n)//arr是指向指针数组的指针{ T sum=0; for(int i=0;i<n;i++) sum+=*arr[i]; //arr[i]是一个指针,+*之后才是其中的数值; return sum;};struct debts{ char name[20]; double amount;};void main87(){ int things[6]={13,.. 阅读全文
posted @ 2014-04-10 22:33 天下纵横C++ 阅读(499) 评论(0) 推荐(0)
摘要: 8.6#include #include using namespace std;template AnyType maxn(AnyType arr[],int size)//模板类{ AnyType max=arr[0]; for(int i=0;imax) max=arr[i]; } return max;};template string maxn(string arr[],int size)//具体化{ int max=0;//用于记录最大的字符串长度 int temp=0;//用于记录字符串长度 int place=0;//用于记录所在位置 for(int i=0;imax) ... 阅读全文
posted @ 2014-04-10 22:11 天下纵横C++ 阅读(238) 评论(0) 推荐(0)
摘要: 8.5#include using namespace std;template AnyType max5(AnyType arr[5]){ AnyType max=0; for(int i=0;imax) max=arr[i]; } return max;};void main85(){ int a[5]={10,20,50,6,33}; double b[5]={5.2,3.5,6.7,8.8,4}; cout<<"the amax is "<<max5(a)<<endl; cout<<"the bmax is 阅读全文
posted @ 2014-04-10 21:46 天下纵横C++ 阅读(204) 评论(0) 推荐(0)
摘要: 在百度知道里面得到了正确的答案http://zhidao.baidu.com/question/198940026560129285.html?quesup2&oldq=1#include#include //出问题时,使用的是cstring,但换成string一样出问题using namespace std;struct stringy{ char *str; int ct;};void set(stringy &beany,const char t[]);void show(const stringy &beany,int count=0);void show(co 阅读全文
posted @ 2014-04-10 16:34 天下纵横C++ 阅读(207) 评论(0) 推荐(0)