When I call the function cost, it just prints out to 0.
The program runs but I just need help solving this.
------------------------------------------------------------------
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int price;
int quantity;
int amount;
double cost;
cout << "What is the given price? $";
cin >> price;
cout << "For how many items? ";
cin >> quantity;
cout << "How many would you like to purchase? ";
cin >> amount;
Its the way we were asked to complete the program. Without using any other variables or without changing the type of them.
Let's say I use $2 for the price, 7 for the quantity and 12 for the amount I would want to purchase. Doing the problem that's suppuse to be assigned to cost comes out to 3.42857. I have to print that out then afterwards just make it print with two decimal points.