博文
c/c++基礎習題解決(1)--找出第3名学生的成绩(2007-07-27 21:19:00)
摘要:ACM大学刚考完大学英语4级考试,想知道全校第3名学生的成绩是多少?如果最高分有好多个学生,则相同成绩的学生都算第一名;同理,如果第二高分的有多个学生,都算第二名。当然这是简单题,请你快速编一个程序找到第3名的成绩。输入:输入有多组,每组有2行,第一行是学生人数N(1<=N<10000),第二行有N个整数,分别表示每个学生的成绩(0到1e9)。当输入的N为0的时候结束程序。输出:对于每组输入,输出只有一行,即第3名学生的成绩,如果找不到,则输出No such score !Sample input:1090 84 90 60 70 65 73 85 98 98590 90 89 90 900Sample output:85No such score !难度:for beginnerTime limit: 50ms Memory: 200K
--試題來源:飛燕之家c/c++學習論壇
解決代碼:
#include <iostream>#include <assert.h>#include <memory.h>using namespace std;
//define some constantsconst int MAXNUM =10000;const int THENUM ......
c++中链表操作(2006-08-03 22:22:00)
摘要:http://www.angeltears.cn/dispbbs.asp?boardID=20&ID=130&page=1......
[原创](C++)循环链表操作及应用(约瑟夫环问题)(2006-08-03 22:21:00)
摘要:http://www.angeltears.cn/dispbbs.asp?boardID=20&ID=928&page=1......
[原创]c++排序算法实现(2006-08-03 22:20:00)
摘要:http://www.angeltears.cn/dispbbs.asp?boardID=20&ID=929&page=1......
[原创]c++模板实现带头结点的链表操作(2006-08-03 22:19:00)
摘要:http://www.angeltears.cn/dispbbs.asp?boardID=20&ID=930&page=1......
[原创](C++模板)多项式运算(加减乘法)(2006-08-03 22:18:00)
摘要:http://www.angeltears.cn/dispbbs.asp?boardID=20&ID=931&page=1......
[原创](C++)稀疏距阵操作(2006-08-03 22:17:00)
摘要:http://www.angeltears.cn/dispbbs.asp?boardID=20&ID=932&page=1......
[原创]链表实现多项式加法(数据封装和重载)(2006-08-03 22:14:00)
摘要:http://www.angeltears.cn/dispbbs.asp?boardID=20&ID=972&page=1......
面向对象c++数据结构描述==>>线性表的操作(类模版的应用)(2005-09-23 23:46:00)
摘要:#ifndef list_H#define list_H#include"List_Node.h"template<class T>class list:public listnode<T>{ private: listnode<T>* head; listnode<T>* tail; listnode<T>* current; static int size; public: list(T b,listnode<T>* ptrnext):listnode<T>(b,ptrnext) { head=tail=current=0; } ~list(); bool insertnode(T num1,int); bool deletenode(T num2); int searchnode(T num3); void showlist(); int getsize(); int menu1();};template <class T>int list<T>::size=0;#endif#ifndef List_Node_H#define List_Node_H template <class T>class listnode{private: T value; listnode<T>* next;public: listnode(T a=0,listnode<T>* ptrnext=0) { value=a; next=ptrnext; } ~listnode() {} T getnode() { return valu......
面向对象c++数据结构==>>数组(2005-09-06 22:15:00)
摘要:#ifndef MGR
#define MGR
class arraymgr
{
int total_elements,max_elements;
int * thearray;
public:
arraymgr(int);
~arraymgr();
bool addelement(int);
bool getelement(int,int &);
bool deleteelement(int);
bool findelement(int,int &);
void showelements();
int getsize();
};
#endif
#ifndef a
#define a
#include"mgr.h"
#include<iostream>
using namespace std;
arraymgr::arraymgr(int num)
{
max_elements=num;
total_elements=0;
thearray=new int [max_elements];
}
arraymgr::~arraymgr()
{
delete [] thearray;
}
bool arraymgr::addelement(int num2)
{
if(total_elements>=max_elements-1)
 ......
