I have created a user input.
I want to display the inputs I have taken from the for
loop.
i dont know how to arrays tho (edited) This is all I have. My code explains more:
Item Priority Financed Cost
---- -------- -------- -----------
1 1 n 39030.15
2 3 y 1200000.00
3 2 n 350500.25
---- -------- -------- -----------
$ 1589530.40
something like this
here is my code
#define _CRT_SECURE_NO_WARNINGS
#define minINCOME 500.00
#define maxINCOME 400000.00
#include <stdio.h>
int main(void)
{
float userIncome ;
int wishlistItems;
float itemCost;
const float minitemCost = 100.00;
int itemImp;
char finance;
printf("+--------------------------+\n"
"+ Wish List Forecaster |\n"
"+--------------------------+\n\n");
do
{
printf("Enter your monthly NET income: $");
scanf(" %f", &userIncome);
if (userIncome < minINCOME)
{
printf("ERROR: You must have a consistent monthly income of at least $500.00\n\n");
}
else if (userIncome > maxINCOME)
{
printf("ERROR: Liar! I'll believe you if you enter a value no more than $400000.00\n\n");
}
} while( (userIncome > maxINCOME || userIncome < minINCOME));
do
{
printf("How many wish list items do you want to forecast?: ");
scanf(" %d", &wishlistItems);
if (wishlistItems > 10 || wishlistItems < 1)
{
printf("ERROR: List is restricted to between 1 and 10 items.\n\n");
}
} while (wishlistItems > 10 || wishlistItems < 1);
for (size_t i = 1; i <= wishlistItems; i++ )
{
do {
printf("Item-%d Details:\n", i);
printf(" Item cost: $");
scanf(" %f", &itemCost);
if (itemCost < minitemCost)
{
printf(" ERROR: Cost must be at least $100.00\n");
}
} while (itemCost < minitemCost);
do {
printf(" How important is it to you? [1=must have, 2=important, 3=want]: ");
scanf(" %d", &itemImp);
if (itemImp < 1 || itemImp >3 )
{
printf(" ERROR: Value must be between 1 and 3\n");
}
} while (itemImp < 1 || itemImp >3);
do {
printf(" Does this item have financing options? [y/n]: ");
scanf(" %c", &finance);
if (finance != 'y' || finance != 'n')
{
printf(" ERROR: Must be a lowercase 'y' or 'n'\n");
}
} while (finance != 'y' || finance != 'n');
}
return 0;
}