On 5/22/07, mkaylad99 <[EMAIL PROTECTED]> wrote:
> [mod-- If you want people to help, then you'll have to clean
> up the source, or be more careful with your copy/pasting. --mod PN]
>
> This is the program that I created but for some reason I could not
> get it to run. Where did I go wrong?
>
>
> '#include <stdio.h> Main ()'' ''char firstinit=''\0'',
> lastinit=''\0'' ''float item1=14.99 item2=5.25 item3=1.85 item4=1.75
> item5=14.88 tax=4.30 subtotal=53.72,total=58.02; ''float
> taxrate=0.08; ''("\nPlease type the first letter of your first name,
> then press enter.") ''scanf("%c",&firstinit)''getchar()'' printf
> ("\nPlease type the first letter of your last name, then press
> enter.")'' scanf("%c",&lastinit)'' getchar()'' printf("\nPlease type
> the cost of the first item, then press enter.")'' scanf("%.2f",
> &item1)'' getchar()'' printf("\nPlease type the cost of the second
> item, then press enter.")'' scanf("%.2f", &item2)'' getchar()'' printf
> ("\nPlease type the cost of the third item, then press enter.")''
> scanf("%.2f", &item3)'' getchar()'' printf("\nPlease type the cost of
> the fourth item, then press enter.")'' scanf("%.2f", &item4)'' getchar
> ()'' printf("\nPlease type the cost of the fifth item, then press
> enter.")''  scanf("%.2f", &item5)'' getchar()''
> subtotal=item1+item2+item3+item4+item5; tax=subtotal*taxrate;
> total=subtotal+tax; printf("\n%c",firstinit,".")'' printf("\n%
> c",lastinit,".")'' printf("Your total cost is $%.2f",total)'' getchar
> ()

Be more specific -- when you say "can't get it to run", do you mean it
doesn't compile? Does it crash? Do you get any error messages? I can't
even tell how correct the code is because it's all pushed together on
a single line -- but it looks like you are also missing a LOT of
semicolons at the ends of statements, incorrect use of printf, no
brackets, misplaced quotes, use of Main() instead of main(), and so
on.

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to