0
What am I doing wrong
#include <iostream> using namespace std; int main() { int overhead = 1000000; int price = 3000000; int cost = 2000000; int sold; int income; int made = 10; int expenses = (cost*made) + overhead; income = sold*price; int profit = income-expenses; if (profit < 0) { cout << "loss" << endl; } else if (profit == 0){ cout << "broke even" << endl; } else { cout << "profit" << endl; } }
3 Answers
+ 10
Value of variable sold is null that means you need to initialise it first than you can perform any operation with it.
+ 4
in statement
income = sold*price;
you use uninitialized variable sold.
set it in some value, for example:
int sold = 5;
0
Thank you everyone I got it to work