🔒 Closed Pa help C++ problem array and looping.

Status
Not open for further replies.

Elecit23

Eternal Poster
Monthly Household Expenses – Create arrays (maximum size 15) that will hold the
following information: category and amount. Allow the user to enter the category (ex.
Water bill) and the corresponding amount spent on it every month. After the data entry,
display the household categories and its corresponding amount in descending order
(highest amount first) and the total amount spent in a month. Please validate the data:
categories must not be blank and amount should not be less than 0. Entries may be less
than 15 but not less than 0.

tapos ko na po yung code ang dko lang alam gawin po ay ito
"categories must not be blank and amount should not be less than 0. Entries may be less
than 15 but not less than 0."

please pa help po Thank you in advance....
 
gawa ka ng if else to check if meron values yung field. if else din gagamitin pag confirm if yung value more or less than zero.

ex.
Code:
int a, b;
b = int get();

if (a > 0){

 //condition

  if (a > 15){

  }else{

  }

}else{

}

ex.
if else statement.
String.IsNullOrEmpty(a.ToString());
 
ganito kasi dapat yan sir eh if I ask the use to input category tas wala syang iniput dapat yung program ko e ask ulit yung user hanggang sa mag input ang user ng category
 
ganito kasi dapat yan sir eh if I ask the use to input category tas wala syang iniput dapat yung program ko e ask ulit yung user hanggang sa mag input ang user ng category
Tulad ng sabi sa taas gawan mo ng if else.. E checheck if meron bang laman na value ang input ng user.

Or
Ganito na nasa loop if ok lang sau.

ex.

int userInput;

while (userInput != null || userInput! =0 ){
"Enter Category name "
userInput = scan mo input user;
}
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 677
    Views
  • 3
    Participants
Last reply from:
ewe we

Trending Topics

Online now

Members online
470
Guests online
2,368
Total visitors
2,838

Forum statistics

Threads
2,282,842
Posts
29,011,491
Members
1,223,143
Latest member
petef1303
Back
Top