Originally Posted by
Perspolice1993
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")