Ask coding questions

← Back to all posts
C Programming
zeno99 (0)

Can anyone help me in assigning a room according to each student ID for my C programming?
For example, there is 3 types of room which is room A, B and C that have different price. How can I assign a room to a student who have book the room?

This is my code but its a bit weird:

int check, week, studid, room, amt_due, bill;
char gender;
char Name[100];
char Room[100], Bill[100];
int Internet, Meal;

void BlockA()
{
printf("This is Block A: \n1- A1 Single Bed\n2- A2 2-Bedded\n3- A3 3-Bedded\nPlease enter your option: ");
scanf("%d",&check);
switch(check)
{
case 1:
Room = "400";
break;
case 2:
Room = "200";
break;
case 3:
Room = "150";
break;
default:
MainMenu();
}
}

Commentshotnewtop
SPQR (421)

someone correct me if I'm wrong, but I don't think we're supposed to help with homework :P

mwilki7 (284)

Book a room at random?
Or book a room that the student picks?