hello,can someone help me?
I must make a program which contains:
Deck (the data in it must be integer(numbers)),(if possible,in header file).
Sort the elements by the method of Shell
Find the elements that can be divided by 5, and smaller then the largest number that can be divided by 7.
The results(if possible in header file).
Function main() with menu of the functions, and checking the status of the data.
I understand this well,but I can't do it. I've tried so long and I just can't.
You are my last hope.
Thanks
[code=language]
#include<iostream.h>
#include<conio.h>
void push_l(int n);
void push_r(int n);
void shellsort(int a[];int left;int right);
struct deck1{
int key;
deck1*next;
}
*left=NULL;
*right=NULL;
void main(){
int num;
do{
int numb;
cout<<"Menu:\n";
cout<<"1-Add elements(left)\n";
cout<<"2-Add elemens(right)\n";
cout<<"3-Find elements\n";
cout<<"4-Sort\n";
cout<<"5-Results\n";
cout<<"6-End\n";
cout<<"Select:";
cin<<num;
switch(num){
case(1):
case(2):
out<<"Add elements:";
cin>>numb;
if(num 1)
push_l(numb);
else
push_r(numb);
break;
case(3):{
if(numb%5&&numb<(i don't know how to do this)
cout<<numb<<"\n";
getche();
}
else{
cout<<"There's no such number!\n";
getch();
}
break;
case(4):
cout<<numb.shelsort()<<"\n";
break;
case(5):
cout<<numb<<\n;
while(num!6);
break;
}
void push_l(int n){
deck1 *p;
p=left;
left=new deck1;
left->key=n;
left->next*p;
if(right==NULL){
right=left;}
}
void push_r(int n){
deck1*p;
p=right;
right=new elem;
right->key=n;
right->next=NULL;
if(left==NULL)
left=right;
else
p->next=right;
}
void shellsort(int a[];int left;int right){
int h;
for(h=1;h<=(right-left)/9;
h=3*h+1;
for(;h>0;h/=3)
for(int i=left+h;i<=right;i++){
int j=i;
int v=a[i];
while(j)=left+h&&v<a[j-h]){
a[j]=a[j-h];
j-=h;}
a[j]=v;
}
}}}