Hi i need to do program which should do:
you have been asked to develope a program that displays a menu for the use to choose to calucalte the following:addition,multiplication,division,subtract,domparing two numbers. the program need to contain IF statment and option to close the program
I got this and don't rl know what i should do how i need to do i got no idea .
#include <iostream.h>
#include <conio.h>
int main ()
{
int intn;
while (intn != 0)
{
cout<< "********************" <<endl;
cout<<"enter 1 for..." <<endl;
cout<<"enter 2 for..." <<endl;
cout<<"enter 0 to exit"
cout<<"********************" <<endl;
cout<<"select your choice:" ;
cin>>intn;
switch (intn)
{
case 1:
Don't use <iostream.h>, use <iostream>. You never initialized int intn, so this statement while(intn !=0) won't work because there is no value for intn. If you need to have if() statements, why are are you using a switch-case statement? Hope this helped.
Technically, intn will typically have a non zero value by default. It is given a value that was in the memory slot from previous applications.
Also, your switch will display "Warning: Invalid selection. Pleas try again\n" even when you enter 0 since you don't cover the 0 case.
Also, this is not a homework service, we won't do your project for you. However, if you make a better attempt at trying to write the rest of your program, we can assist. If you're unsure about how to do something, there is a tutorial and reference on this site for you to look at to understand how to implement your ideas into code. It's definitely worth looking at as I look at both on an almost daily basis.