Thread: Help Needed On A Program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #32
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Perspolice1993 View Post
    can you at least tell me why when i do this code it asks the first question, but when i put 50 30 it prints the second and third question

    Code:
    printf ("What are the length and width of the room (in feet)?\n");
        scanf("%d, %d\n", &length_of_room, &width_of_room);
    
        printf ("What are the length and width of each table?\n");
        scanf("%d, %d\n", &length_of_table, &width_of_table);
    
        printf ("How much space is required between each table?\n");
        scanf("%d\n", &space_walls_tables);
    
        printf ("What is the max number of people per table?\n");
        scanf("%d", &people_per_table);
    Lose the \n from your scanf()...

    Like this...

    Code:
    printf ("What are the length and width of the room (in feet)?  ");
        scanf("%d, %d", &length_of_room, &width_of_room);
    
        printf ("\nWhat are the length and width of each table?  ");
        scanf("%d, %d", &length_of_table, &width_of_table);
    
        printf ("\nHow much space is required between each table?  ");
        scanf("%d", &space_walls_tables);
    
        printf ("\nWhat is the max number of people per table?  ");
        scanf("%d", &people_per_table);
        printf("\n\n");
    See how nicelty that sits on your screen?

    Now... go look up scanf() in your C Library Documentation... (Yep, I'm saying "Read The Help File")
    Last edited by CommonTater; 09-11-2011 at 03:20 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Program solution needed...
    By vijay.neo in forum C Programming
    Replies: 6
    Last Post: 10-18-2006, 11:12 PM
  2. Some help needed with program.
    By ajdspud in forum C++ Programming
    Replies: 2
    Last Post: 12-06-2005, 03:36 PM
  3. Help needed with program.
    By ajdspud in forum C++ Programming
    Replies: 6
    Last Post: 11-22-2005, 04:05 PM
  4. Program crashes...help Needed!!
    By butterfly in forum C++ Programming
    Replies: 4
    Last Post: 05-31-2002, 11:22 AM
  5. redirection program help needed??
    By Unregistered in forum Linux Programming
    Replies: 0
    Last Post: 04-17-2002, 05:50 AM

Tags for this Thread