No sé por qué no funciona mi contraseña, todo bien hasta que le agregue eso
Publicado por Miguel (5 intervenciones) el 03/04/2020 01:22:07
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include <conio.h>
#include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;
int main() {
int opc;
mr:
char pass[10];
int correcto;
int intento;
const char contraseña[] = "1999";
intento=1;
correcto = 0;
printf("Introduce the password:"); get(pass); printf("\n");
if (strcmp(pass,contraseña)==0) correcto=1;
while ((correcto==0)&&(intento<3))
{
intento++;
printf("contraseña incorrecta. %i intento:", intento); gets(pass); printf("\n");
if (strcmp(pass,contraseña)==0) correcto=1;
}
if (correcto==0) printf("se ha excedido el numero de intentos.");
else{
system("cls");
cout << "\t The Planet earth \n";
cout << "\t ++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++++++++++++++++ \n";
cout << "\t +++++++++++++++++++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++++++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++°°°°°°°++++++++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++°°°++°°°°°°°°°°++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++°°°++°°°°°°°°°°°°°°+++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++°°+++°°°°°°°°°°°°°°+++++++++++++++++++++ \n";
cout << "\t +++++++++++++++++°°++°°°°°°°°°°°°°°+++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++General Menu°+++++++++++++++++++++ \n";
cout << "\t +++++++++++++++++++++++°°°°°°°°°°°°+++++++++++°+++++++++ \n";
cout << "\t ++++++++++++++++++++++++°°°°°°°°°°°+++++++++°°°+++++++++ \n";
cout << "\t +++++++++++++++++++++++++°°°°°°°°°°°°++++°°°°++++++++++ \n";
cout << "\t +++++++++++++++++++++++++°°°°°°°°°°°°°°°°°++++++++++++ \n";
cout << "\t +++++++++++++++++++++++++++°°°°°°°°°°+++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++++++++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++++++++++++++++++++++++ \n";
cout << "\t ++++++++++++++++++++++++++++++++++++++ \n";
cout << "\t +++++++++++++++++++++++++++++++++ \n";
cout << "\t +++++++++++++++++++++++++ \n";
cout << "\t +++++++++++++++ \n";
cout << "\t Geology \n";
cout << "\t \n";
cout << "\t\t\t********************************************\n\n";
cout << "\t\t\t\t ^ Chose one number, please ^ \n\n";
cout << "\t\t\t********************************************\n\n";
cout << " 1. Program 16 \n";
cout << " 2. Program Inch to cm \n";
cout << " 3. Phrase and Number \n";
cout << " 4. House hitch \n";
cin >> opc;
switch (opc) { //star to the menu
case 1:
cout << "Print from 1 to 10 except the 5 !\n";
{ // <-- Block
int i;
for (i = 1; i <= 10; i++)
if (i == 5)
continue;
else
printf("%d \n\n", i);
} // <-- end block
break;
case 2:
{ // <--- Block
int variable;
cout << "Inches to centimetres!\n";
float pulgadas;
cout << "Inches:\n";
cin >> pulgadas;
cout << pulgadas << " Inches are " << pulgadas * 2.54 << " centimeters" << endl;
} // <-- end block
break;
case 3:
cout << "Repeat the phrase accord to the number!\n";
{ // <-- block
string phrase;
int n;
cout << "Introcuce Phrase\n";
cin >> phrase;
cout << "...and an number: ";
cin >> n;
for (int i = 1; i <= n; i++)
cout << phrase << endl;
} // <-- endblock
break;
case 4:
cout << "House Hitch!\n";
{
float housecost, income;
cout << "\n House Cost: "; cin >> housecost;
cout << "\n Monthly Income: "; cin >> income;
cout << "\nInitial Payment: ";
if (income < 8000)
{
cout << housecost * 0.15 << endl;
housecost -= housecost * 0.15;
cout << "\n Monthly payment during 10 years: " << housecost / 10 / 30 << endl;
}
else
{
cout << housecost * 0.30 << endl;
housecost -= housecost * 0.30;
cout << "\n Monthly payment during 7 years: " << housecost / 7 / 30 << endl;
}
}
break;
}
//End Menu
cout << "\t*****************************************************************\n";
cout << "\t Do you want to return at the menu, press 1 for yes or 2 for not\n";
cout << "\t*****************************************************************\n";
int resp; cin >> resp;
if (resp == 1) {
goto mr;
}
else {
cout << "Babe i'm gonna leave you";
}
}
// Todo lo demás esta bien, hasta el momento en que agrego la contraseña es cuando hay problema y me aparece una lista enorme de problemas
Valora esta pregunta
0