Name: Anonymous 2007-12-06 10:34
Hey, i am having some trouble with this c++ code i am working on. the switch is not working right and it just loops with out accepting input. any help is appriciated.
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
void Menu(void);
void TAMSaleY(void);
void TAMSaleQ(void);
void MEASales(void);
void GLSales(void);
void AnyKey(void);
char *Month[12]={"January","Febuary","March","April","May","June","July","August","September","October","November","December"};
int Msale[12] = {46987,43768,38987,36181,35129,40245,52156,49546,51120,47345,45675,53769},X;
void main()
{ do
{ Menu();
switch(X)
{ case'1':
TAMSaleY();
break;
case'2':
TAMSaleQ();
break;
case'3':
MEASales();
break;
case'4':
GLSales();
break;
case'5':
break;
X=5;
default:
cout << "\nEnter 1,2,3,4 or 5." << endl;
AnyKey();
}
}while(X != '5');
} // end of main()
void AnyKey(void)
{ system("pause");
system("cls");
}
void Menu(void)
{ system("cls");
cout << "Enter a selection:\n\n1)Total and Average Monthly Sales(Annual)\n2)Total and Average Monthly Sales(Quaterly)\n3)Months Exceeding Average Monthly Sales\n4)Highest and Lowest Performing Month\n5)Exit\n";
}
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
void Menu(void);
void TAMSaleY(void);
void TAMSaleQ(void);
void MEASales(void);
void GLSales(void);
void AnyKey(void);
char *Month[12]={"January","Febuary","March","April","May","June","July","August","September","October","November","December"};
int Msale[12] = {46987,43768,38987,36181,35129,40245,52156,49546,51120,47345,45675,53769},X;
void main()
{ do
{ Menu();
switch(X)
{ case'1':
TAMSaleY();
break;
case'2':
TAMSaleQ();
break;
case'3':
MEASales();
break;
case'4':
GLSales();
break;
case'5':
break;
X=5;
default:
cout << "\nEnter 1,2,3,4 or 5." << endl;
AnyKey();
}
}while(X != '5');
} // end of main()
void AnyKey(void)
{ system("pause");
system("cls");
}
void Menu(void)
{ system("cls");
cout << "Enter a selection:\n\n1)Total and Average Monthly Sales(Annual)\n2)Total and Average Monthly Sales(Quaterly)\n3)Months Exceeding Average Monthly Sales\n4)Highest and Lowest Performing Month\n5)Exit\n";
}