SHOW:
|
|
- or go back to the newest paste.
1 | - | // Fix1Ex5.cpp : Defines the entry point for the console application. |
1 | + | // Fix1Ex6.cpp : Defines the entry point for the console application. |
2 | // | |
3 | ||
4 | #include "stdafx.h" | |
5 | #include <stdio.h> | |
6 | #include <iostream> | |
7 | ||
8 | using namespace std; | |
9 | ||
10 | - | #define TAMANHO 100 |
10 | + | void qualEOMaior(int val1, int val2, int val3); |
11 | ||
12 | - | void contarMaiusculas(char frase[]); |
12 | + | |
13 | { | |
14 | int val1, val2, val3; | |
15 | printf("Introduza um numero inteiro: "); | |
16 | - | printf("Escreva uma frase: "); |
16 | + | scanf("%d", &val1); |
17 | - | char frase[100]; |
17 | + | printf("\nIntroduza outro numero inteiro: "); |
18 | - | gets(frase); |
18 | + | scanf("%d", &val2); |
19 | - | contarMaiusculas(frase); |
19 | + | printf("\nIntroduza um ultimo numero inteiro: "); |
20 | - | return 0; |
20 | + | scanf("%d", &val3); |
21 | ||
22 | qualEOMaior(val1, val2, val3); | |
23 | - | void contarMaiusculas(char frase[]){ |
23 | + | |
24 | - | int minus = 0, maius = 0; |
24 | + | |
25 | void qualEOMaior(int val1, int val2, int val3){ | |
26 | - | for (int contador = 0; contador < TAMANHO; contador++){ |
26 | + | if (val1 > val2 && val1 < val3) |
27 | - | |
27 | + | printf("\n%d e o maior do meio.", val1); |
28 | - | if (frase[contador] >= 65 && frase[contador] <= 90) |
28 | + | |
29 | - | maius++; |
29 | + | else if (val2 > val1 && val2 < val3) |
30 | - | else if (frase[contador] >= 97 && frase[contador] <= 122) |
30 | + | printf("\n%d e o maior do meio.", val2); |
31 | - | minus++; |
31 | + | |
32 | - | else if (frase[contador] == '\0') //string terminou |
32 | + | else if (val3 > val1 && val3 < val2) |
33 | - | break; |
33 | + | printf("\n%d e o maior do meio.", val3); |
34 | - | }//for |
34 | + | } |