adding items to get a total price of a computer.

So the code that I have done so far is below, basically I need to build a program that will allow a user to select one of the items from each list (i.e cpu, hard drive, monitor) then add up the total price. My question is how do I get the program to allow the user just to select one from each category then total up the price together to give them the overall price that it would cost?

#include <stdio.h>
int main ()
{
/* variable definition: */
printf("Select what type of CPU you want?");
double CPU1, CPU2, CPU3;

/* Prices of CPU */
CPU1 = 338.99;
CPU2 = 85.90;
CPU3 = 56.99;

printf("Select what type of Hard Drive you want?");
float HD1, HD2, HD3;

/* Prices of Hard Drives */
HD1 = 52.99;
HD2 = 135.04;
HD3 = 97.73;

printf("Select what type of Monitor you want?");
float M1, M2, M3;

/* Prices of Hard Drives */
M1= 149.99;
M2= 99.99;
M3= 195.99;

return 0;
}
closed account (48T7M4Gy)
Hint: Try a loop of some sort based on user input.
Last edited on
Topic archived. No new replies allowed.