0
I would like to make the user type a printf()
at a time, being the "Name, RG and Email" but as soon as I type the name, it executes everything else and ends the program, as I make it stop in the next printf()
for the user?
int main () {
setlocale(LC_ALL, "Portuguese");
int opcao, tipoPessoa, nomePessoa, rgPessoa, emailPessoa;
printf("Bem Vindo ! \n O que deseja fazer ? \n 1 - Se cadastrar \n 2 - Reservar um lugar \n");
scanf("%d",&opcao);
if (opcao == 1){
printf("Você é: \n 1 - Professor \n 2 - Aluno \n 3 - Convidado \n 4 - Portador de necessidade especial \n");
scanf("%d", &tipoPessoa);
switch(tipoPessoa){
case 1: printf("Informe seu nome completo: ");
scanf("%d", &nomePessoa);
printf("Informe seu RG: ");
scanf("%d", &rgPessoa);
printf("Informe seu E-mail: ");
scanf("%d", &emailPessoa);
}
}
}
First thing, why do you want everything to be a whole? The mistake could be this, because I see nothing that can cause the problem described, in fact, even so is to give this problem.
– Maniero
I’m actually a beginner in C, maybe that’s the problem ? what would be the solution ?
– Victor Fernandes
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero