Escolar Documentos
Profissional Documentos
Cultura Documentos
ALGORITMO – O JOGO
FEIRA DE SANTANA – BA
2020
ALUNO: LEANDRO LIMA
INTRODUÇÃO A COMPUTAÇÃO:
ALGORITMO – O JOGO
FEIRA DE SANTANA – BA
2020
1ª Questão: utilizando a instrução “while” ou “do ... while”, crie um jogo de
perguntas e respostas com no mínimo 3 perguntas onde o jogador terá 3
chances para cada pergunta.
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main(){
int acertos=0;
char in;
system("color B0");
setlocale(LC_ALL,"Portuguese");
printf("======================\n");
printf("======================\n\n");
scanf("%c",&in);
while(in=='f'){
system("cls");
system("color 9F");
char altern;
int chance=1;
while(chance<=3){
scanf(" %c",&altern);
if(altern=='b'){
acertos++;
break;
chance++;
system("cls");
system("color 67");
char altern2;
chance=1;
while(chance<=3){
scanf(" %c",&altern2);
if(altern2=='a'){
acertos++;
break;
}
chance++;
system("cls");
system("color 70");
char altern3;
chance=1;
while(chance<=3){
scanf(" %c",&altern3);
if(altern3=='e'){
acertos++;
break;
chance++;
system("cls");
system("color 4F");
char altern4;
chance=1;
printf("4° QUAL A LINGUAGEM UTILIZADA PELOS
COMPUTADORES?\n\n a) LINGUAGEM C\n b) 1 BIT (BINÁRIO)\n c) JAVA\n d)
PASCAL\n e) PHYTON");
while(chance<=3){
scanf(" %c",&altern4);
if(altern4=='b'){
acertos++;
break;
chance++;
system("cls");
system("color 5F");
char altern5;
chance=1;
while(chance<=3){
scanf(" %c",&altern5);
if(altern5=='d'){
acertos++;
break;
}
chance++;
system("cls");
system("color F0");
char altern6;
chance=1;
while(chance<=3){
scanf(" %c",&altern6);
if(altern6=='e'){
acertos++;
break;
chance++;
system("cls");
system("color DF");
char altern7;
chance=1;
scanf(" %c",&altern7);
if(altern7=='a'){
acertos++;
break;
chance++;
system("cls");
if(acertos>=0&&acertos<=2)
if(acertos>=3&&acertos<=5)
if(acertos>=6&&acertos<=7)
break;
system("pause");
return 0;