not exactly correct, just give the idea
#include "tqueue.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[]){
Tqueue<int> Q;
if(argv[1][0]== '-' && argv[1][1] == 'a'){
int i;
for(i=0;i<argc-2;i++){
if(sscanf(argv[i],"%d")
Q.append(argv[i]);
else{
count<<"Incorrect call use as follows:"<<endl;
count<<"tq -[a][d] 99 [99 99 ...]"<<endl;
break;
}
Q.sort(true);
do{
cout<<Q.visit()<<" ";
}while(Q.goNext());
}
else if(argv[1][0]== '-' && argv[1][1] == 'd'){
int i;
for(i=0;i<argc-2;i++){
if(sscanf(argv[i],"%d")
Q.append(argv[i]);
else{
count<<"Incorrect call use as follows:"<<endl;
count<<"tq -[a][d] 99 [99 99 ...]"<<endl;
break;
}
Q.sort(true);
do{
cout<<Q.visit()<<" ";
}while(Q.goPrev());
}
return 0;
}
No comments:
Post a Comment