Question: Program isn't compiling Error messages: priceFinder.cpp:28:39: note: couldn't deduce template parameter _Alloc std::cin >> priceValues[x] >> std::endl; ^ priceFinder.cpp:47:13: error: expected ; before string constant
Program isn't compiling
Error messages:
priceFinder.cpp:28:39: note: couldn't deduce template parameter _Alloc std::cin >> priceValues[x] >> std::endl; ^ priceFinder.cpp:47:13: error: expected ; before string constant std::cout "Max: " << max << std::endl; ^ priceFinder.cpp:48:13: error: expected ; before string constant std::cout "Min: " << min << std::endl; ^ priceFinder.cpp:49:13: error: expected ; before string constant std::cout "Average: " << sum / 10 << std::endl; ^ priceFinder.cpp:52:1: error: expected } at end of input } ^ priceFinder.cpp: In function int main(): priceFinder.cpp:47:13: error: expected ; before string constant std::cout "Max: " << max << std::endl; ^ priceFinder.cpp:48:13: error: expected ; before string constant std::cout "Min: " << min << std::endl; ^ priceFinder.cpp:49:13: error: expected ; before string constant std::cout "Average: " << sum / 10 << std::endl; ^ priceFinder.cpp:52:1: error: expected } at end of input } ^
priceFinder.cpp:25:52: error: priceValues cannot be used as a function priceValues(priceValues, priceSize, sum, max, min); ^ priceFinder.cpp: In function void priceValues(float*, int, int, int, int, int): priceFinder.cpp:35:30: error: no match for operator>> (operand types are std::basic_istream
#include
const int priceSize = 10; void priceValues(float [], const int, int, int, int); void price(); int main() { std::string DONE; int sum; int max; int min; bool status = true; std::string prodName; float priceValues[priceSize] = { 0.0 }; std::cout << "Welcome to the price finder program." << std::endl; while(status != false) { std::cout << "Enter a Product Name: "; std::cin >> prodName; if(prodName == DONE) { status = false; } for(int x = 0; x < priceSize; x++) { std::cout << " Enter Price: "; std::cin >> priceValues[x]; sum = sum + priceValues[x];
if(x == 0) { max = priceValues[x]; min = priceValues[x]; } else
{ if(priceValues[x] > max) { max = priceValues[x]; } if(priceValues[x] < min) { min = priceValues[x]; } } std::cout "Max: " << max << std::endl; std::cout "Min: " << min << std::endl; std::cout "Average: " << sum / 10 << std::endl; } return 0; }
This is My program and I can't figure out why it isnt compiling
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
