Thread: Dev C++

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User kw42chan's Avatar
    Join Date
    Jan 2013
    Location
    Hong Kong, China
    Posts
    18

    Dev C++ in compiling in C and C++

    Dears

    I use Dev C++ in compiling, want to write C. i found there is some error. when i rewrite them, i find it regard me as wrong in C.

    Original code.
    Code:
    Main ()
    {
    int revenue;
    int price;
    int quantity;
    printf(“Please input the price”)
    scanf(“%d”, &price)
    printf(“Please input the quantity”)
    scanf(“%d”, &quantity)
    revenue = price* quantity
    printf(“Total revenue is”, &revenue)
    }
    Code as correct in Dev C++
    Code:
    # include <stdio.h>int Main ()
    {
     int revenue;
     int price;
     int quantity;
     printf("Please input the price %c");
     scanf("%d", &price);
     printf("Please input the quantity %c");
     scanf("%d", &quantity);
     revenue = price*quantity;
     printf("Total revenue is %c", &revenue);
    }
    PS I m newbie
    Last edited by kw42chan; 01-04-2013 at 09:46 AM. Reason: More Clear topic illustration

Popular pages Recent additions subscribe to a feed