mercredi 2 mars 2016

C : if-else about variables

i'm new to programming and i am a beginner in C language, i want to ask about my problem when make if else:

A code for every fruits..

A-001 for Apple with $3

A-002 for Grapes with $4

B-001 for Avocado with $2

B-002 for Orange with $1

Then the input will be Quantity, Fruit Code

And the output will be Total (Qty * price )

But when i make it like this :

If (fruitcode=='A-001')

It tells me the character constant too long.. what should i use for the fruit code? Is it just Integer or Characters or what?

Aucun commentaire:

Enregistrer un commentaire