finishing the program

hello there im new here
im with one problem at this part of my program
this program its for one study center
and this fase of the progam its to say how many rooms are registered by one teacher

its supose to search by the name of the teacher how many rooms that he have registered at his name
and if he have registered rooms the program show one message saying "this teacher its registered at (x) roms.
if the teacher dont have one room registered at his name the program show one message saying "this teacher isnt using any room"

if you have one question post it please
if you can finish this part of the program post the solution please
im using dev c++




*******************************************************

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void pornome () 
{
	char pesqui[NOME];
	int y=0;
	system("cls");
	x=0;
	printf("Qual o nome do formador?\n");fflush(stdin);
	gets(pesqui);
	
	for(x=0;x<=SALAS;x++)
	{
		if (strncmp(pesqui,registo[x],strlen(pesqui))==0)
		{
			printf("O formador '%s' encontra-se na sala %d\n",pesqui,x);
		}
	}
	
	if (y==0) 
		{
			printf("O formador '%s' nao se encontra em nenhuma sala \n",pesqui);
		}
}
Last edited on
You're not counting the number of rooms. Also, y isn't used.
1
2
3
4
5
int x , y = 0;
for(x=0;x<=SALAS;x++) if( strcmp( pesqui,registo[x]) == 0) y++;//no need for strncmp

if (y==0) printf("O formador '%s' nao se encontra em nenhuma sala \n",pesqui);
else printf("O formador '%s' encontra-se na sala %d\n",pesqui, y);
tanks hamsterman
this part is now working

i still need to finish 2 more parts to conclude
the other 2 parts that i need its


option 7 has to do:
Shows the historic reserve.
Whenever a reservation is made, the room number, the name of the person who booked and discipline, are stored in a register designated by historical reserves.
This option allows you to view this historic. The user is asked how many records you want to see if this insert and x application displays the last x records.
If you enter 0, the application displays all records.


option 8 has to do:
The application requests a room number and indicates that people rented this room and what the subject taught.

if you can help me finishing the program
post here the solution please

greetings
RenatoCirino


Last edited on
Topic archived. No new replies allowed.