main() { //Personalização de Cor system("color 17"); //Configurando Idioma setlocale(LC_ALL, "Portuguese"); //Banner system("cls"); tela(); //Inicio char senha[30]; int aux; do{ cout<<"\n Digite a senha: "; cin>>senha; aux=strcmp(senha, "apc1") if(aux!=0) cout<<"\n Senha Invalida! "; } while(aux!=0) cout<<"\n Senha Correta!"; getch(); }
int main(){ int x, y; double num1, num2, num3; char letra; mgotoxy(34,9); printf("CALCULATOR\n\n"); tela(); mgotoxy(30,12); scanf("%lf", &num1); do{ mgotoxy(33,13); scanf("%s %lf", &letra, &num2); //scanf("%c", &letra); //scanf("%d", &num2); system("CLS"); if(letra == 's'){ //da o comando para sair return 0; } if(letra == '+'){ //soma num1 = num1 + num2; mgotoxy(34,9); printf("CALCULATOR\n\n"); tela(); mgotoxy(34,12); printf("%lf", num1); } if(letra == '-'){ //subtracao num1 = num1 - num2; mgotoxy(34,9); printf("CALCULATOR\n\n"); tela(); mgotoxy(34,12); printf("%lf", num1); } if(letra == '*'){ //multiplicacao num1 = num1 * num2; mgotoxy(34,9); printf("CALCULATOR\n\n"); tela(); mgotoxy(34,12); printf("%lf", num1); } if(letra == '/'){ //divisao num1 = num1 / num2; mgotoxy(34,9); printf("CALCULATOR\n\n"); tela(); mgotoxy(34,12); printf("%lf", num1); } getch(); system("CLS"); main(); }while(letra != 's'); return 0; }
int main(void) { //Manipulação dos scores std::ifstream inputFile; std::ofstream outputFile; char buff[500]; char nome[100]; int pontos; int fase; //Scores std::vector<Player> scores; //Leitura de arquivo e gravação da lista de players inputFile.open(ENTRADA); while(!inputFile.fail()){ Player p; inputFile.getline(buff, 500); sscanf(buff,"%s %i %i",nome,&fase,&pontos); std::string name(nome); if(name!=""){ p.setNome(name); p.setPontos(pontos); p.setFase(fase); scores.push_back(p); } } inputFile.close(); //Applications variables std::vector<cScreen*> Screens; //Window creation Janela App(sf::VideoMode(largura,altura), "STARKANOID",sf::Style::Close); App.setBestScores(scores); //Mouse cursor no more visible App.setMouseCursorVisible(false); App.setFramerateLimit(60); Menu menu(largura,altura); Tela1 tela(App,0); Tela1 tela2(App,1); Tela1 tela3(App,2); Screens.push_back(&menu); Screens.push_back(&tela); Screens.push_back(&tela2); Screens.push_back(&tela3); for(int i=0;i>=0 && i<4;i=Screens[i]->Run(App)){ } outputFile.open(ENTRADA,std::ifstream::trunc); for(unsigned int i=0;i<App.getBestScores().size();i++){ //BestScores guarda os 10 melhores + os correntes outputFile<<App.getBestScores()[i].getNome()<<std::endl; outputFile<<App.getBestScores()[i].getFase()<<std::endl; outputFile<<App.getBestScores()[i].getPontos()<<std::endl; } return EXIT_SUCCESS; }
//inicio programa principal int main() { int temp, umidade; //temperatura atual (dados de entrado) int s_temperatura, s_umidade; //armazena o status do controlador //inicializa com temp e umidade invalida p/ entrar no 'while' de controle temp=101; umidade=101; //inicializa com sensores desligados s_temperatura=DESLIGADO; s_umidade=DESLIGADO; while(1) { while ( (temp < TEMP_MIN) || (temp > TEMP_MAX) ) { //*****ERRO: escrever letras printf("Digite temperatura inicial [-100 a 100]:"); scanf("%i",&temp); } //fim controle temperatura minima/maxima while ( (umidade < UMID_MIN) || (umidade > UMID_MAX) ) { //*****ERRO: escrever letras printf("Digite umidade inicial [-100 a 100]:"); scanf("%i",&umidade); } //fim controle umidade minima/maxima if ((temp < TEMP_MIN_IDEAL) || (temp > TEMP_MAX_IDEAL)) { s_temperatura=LIGADO; if (temp < TEMP_MIN_IDEAL) { // incrementar temp p/ ideal temp++; } if (temp > TEMP_MAX_IDEAL) { // decrementar temp p/ ideal temp--; } } else { s_temperatura=DESLIGADO; } if ((umidade < UMID_MIN_IDEAL) || (umidade > UMID_MAX_IDEAL)) { s_umidade=LIGADO; if (umidade < UMID_MIN_IDEAL) { // incrementar humidade p/ ideal umidade++; } if (umidade > UMID_MAX_IDEAL) { // decrementar humidade p/ ideal umidade--; } } else { s_umidade=DESLIGADO; } tela(temp, umidade, s_temperatura, s_umidade); Sleep (5000); } //fim while 1 return(0); }