error C2446: '==' : no conversion from 'const char *' to 'int'
1> There is no context in which this conversion is possible
and
error C2040: '==' : 'int' differs in levels of indirection from 'const char [4]'
they both refer to the if statement that is pointed out.
EDIT: i have no idea how well the program will actually work so please dont spoil it for me
#include "stdafx.h"
#include <iostream>
using namespace std;
int multiply (int num1, int num2);
int divide (int num1, int num2);
int subtract (int num1, int num2);
int add(int num1, int num2);
int main()
{
bool start = true;
int num1;
int num2;
char strt;
int op;
while (start == true)
cout << "System ready\n" << "Please give 1st of two numbers\n";
cin >> num1;
cout << "Please give 2nd number\n";
cin >> num2;
cout << "What would you like to do with these numbers?\n1.Add\n2.subtract\n3.multiply\n4.divide";
cin >> op;
switch (op)
{
case 1:
{
add (num1, num2);
break;
}
case 2:
{
subtract (num1, num2);
break;
}
case 3:
{
multiply (num1, num2);
break;
}
case 4:
{
divide (num1, num2);
break;
}
default:
{
cout << "\nPROGRAM ERROR!!!";
start = true;
}
}
cout << "\nWould you like to start again?";
cin >> strt;
if (strt == 'y' || strt == 'Y' || strt == "yes") //This line here is what seems to be giving me
start = true; // trouble
else
start = false;
return 0;
}
int multiply (int num1, int num2)
{
int result;
result = num1 * num2;
return result;
}
int divide (int num1, int num2)
{
int result;
result = num1 / num2;
return result;
}
int subtract (int num1, int num2)
{
int result;
result = num1 - num2;
return result;
}
int add(int no1, int no2)
{
int rsult = no1 + no2;
return rsult;
}
please note, i know there are 'cleaner' ways to make a simple calculator, but this is to try and understand the switch statement and the calling functions, thanx guys.
This post has been edited by Pipey85: 30 June 2009 - 11:07 AM

New Topic/Question
Reply



MultiQuote





|