Jump to content
Wan Asyraf Wan Othman

Bantuan Diperlukan

Recommended Posts

[size=2]#include <stdio.h>[/size]

[size=2]int main(void) {[/size]
[size=2]/*INPUT DECLARATION*/[/size]
[size=2]char order;[/size]
[size=2]int x;[/size]

[size=2]/*A LOOP FOR USER TO ENTER ORDER MORE THAN 1 TIME*/[/size]
[size=2]for(; x=1; x++ ){[/size]
[size=2]printf("PLESE PLACE YOUR ORDER ENTER X TO EXIT\n");[/size]
[size=2]scanf("%c", &order(x));[/size]
[size=2]}[/size]
[size=2]return 0;}[/size]


Sesapa ada idea tak, aku cuba buat bila user masuk order baru, sistem akan baca sebagai, order1, order2, order3 dan lain2... tapi aku ada masalah dekat scanf, yang menjadi error.. ada idea tak setel masalah nii..

Share this post


Link to post
Share on other sites
Apa yg kurang dlm coding nii..

struct OrderInfo // part ni mcm x betul ckit..
{
char FoodDrinks[20];
float price, quantity;
};




int x, count;
/*A LOOP FOR USER TO ENTER ORDER MORE THAN 1 TIME*/
for(; x=1; x++ ){
printf("PLESE PLACE YOUR ORDER ENTER X TO EXIT\n");
scanf("%s", &OrderInfo[x].FoodDrinks);

count++;
}

Share this post


Link to post
Share on other sites
[quote name='Wan Asyraf Wan Othman' timestamp='1318761507' post='1073794']
float price, quantity;
[/quote]

float dgn price tu kira 2 variable atau satu?

kalo satu kena tambah _ kat bawah atau rapatkan -> floatPrice

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...