Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include <string.h>
- int main(){
- int i;
- char nome[3][30];
- printf("Ola,voce agora estara ajudando a eleger um cadidado!!!\n\n");
- printf("voce ira digitar o nome de tres candidatos:\n");
- int joao,jose,pedro,votoBranco;
- for(i=0;i<3;i++){
- printf("Por favor,entre com o candidato %d:",i+1);
- fgets(nome[i],30,stdin);
- if(nome[i][30]==joao)
- joao++;
- if(nome[i][30]==jose)
- jose++;
- if(nome[i][30]==pedro)
- pedro++;
- if(nome[i][30]==votoBranco)
- votoBranco++;
- }
- printf("Joao recebeu %.0d votos\n",joao);
- printf("Jose recebeu %.0d votos\n",jose);
- printf("Pedro recebeu %.0d votos\n",pedro);
- printf("temos %.0d votos em branco\n",votoBranco);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment