Hi
I am doing a project at the moment it compiles fine but i am getting an unexpected result being numbers on the end if anyone could give me an idea on why its coming up like this as its been a few hours and i cant seem to get it, also any feedback on coding or commenting that i can improve on thanks
I am doing a project at the moment it compiles fine but i am getting an unexpected result being numbers on the end if anyone could give me an idea on why its coming up like this as its been a few hours and i cant seem to get it, also any feedback on coding or commenting that i can improve on thanks
#include<iostream>
#include<conio.h>
#include<iomanip>
using namespace std;
void Multitablefunc(int intMultDisplay);
int main ()
{//declaring variable section
char charMenuchoice =' ';
int intMultTable=0;
int intMultDisplay=0;
//welcome message for front screen
cout<<"Do you want to create a multiplication table (M) or perform a Calculation (C)?"<<endl;
cout<<"Enter (M) or (C) only "<<endl;
//taking in char variable for menu selection
cin>>charMenuchoice;
if (charMenuchoice=='M')//using M takes you into the multiplication table menu
{
system("CLS");
cout<<"Please enter the number you want the multiplication table for "<<endl;
cout<<"Note number must be between 1-20 "<<endl;
cin>>intMultTable;
while (intMultTable>20||intMultTable<0)
cout<<"Sorry please enter a number between 1-20"<<endl;
if(intMultTable<20 || intMultTable>0)
{
system("CLS");
cout<<"Please enter how many lines of the table you want displayed."<<endl;
cout<<"Note number should be between 1-15 only"<<endl;
cin>>intMultDisplay;
Multitablefunc( intMultDisplay);
getch();
}
}
else if (charMenuchoice=='C')//when completed will have calculation functions
system("CLS");
return 0;
}
void Multitablefunc(int intMultDisplay)//multiplication table generator function
{
for( int i=1; i<=intMultDisplay; i++ )
{
cout<<setw(5)<<i;
cout<< endl;
for( int j = 1; j<=intMultDisplay ; j++ )
{
cout << setw(5) << i*j ;
}
}
}