sort and search program using c++ class
来源:百度知道 编辑:UC知道 时间:2024/06/05 05:55:58
A make a 100 random integer value
B do make a sort by ascending order
C get a user input to find a number
D do print out of finding result (found or not found)
E contnue to step C until user input is -1.
due to october 27 2009 befoer class start
B do make a sort by ascending order
C get a user input to find a number
D do print out of finding result (found or not found)
E contnue to step C until user input is -1.
due to october 27 2009 befoer class start
#include<iostream>
#include<time.h>
using namespace std;
class SS
{
private:
int *a;
int num;
int getint(void)
{
int a;
while(1)
{
cin >> a;
if(cin)
break;
cin.clear();
cin.ignore(1024,'\n');
cout<<"Error input, please input an integer!"<<endl;
}
return a;
}
public:
SS(int n)
{
int i;
srand(time(NULL));
a= new int[n];
num=n;
for(i=0;i<n;i++)
a[i]=rand();
}
SS(int n,int maxnum)//0~maxnum
{
int i;
srand(time(NULL));
a= new int[n];
num=n;
for(i=0;i<n;i++)
a[i]=rand()%(maxnum+1);
}
void sort()
{
int i,j,t;
for(i=0;i<num;i++)
for(j=i+1;j<num;j++)
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];<
kind and sort,what's the difference?
It has been suggested that the people who feel lonely and need some sort of_
IF(AND(SEARCH($A$1,A2)>0,SEARCH($B$1,A2)>0,SEARCH($C$1,A2)>0),1,0)
arrays.sort
What market share have Google, Yahoo, Baidu and other search engines in china?
search some topics on the stress of young modern citizen\ employess and list the effects
以Adware开头的病毒危害性大不大?用Spybot Search and Destroy可以清除吗?
这句话是什么意思Please set the condition and click the 'Search'
The way ahead is long; I see no ending, yet high and low I’ll search with my will unbending
sort of 是什么意思?