convertir a pseudocode
Publicado por Jose (6 intervenciones) el 10/02/2018 02:29:08
Buenas equipo, como yo puedo hacer un pseudocode para estas funciones?
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
int main()
{
// Get the temperature from the user
float tempF = getTemp();
// Do the conversion
float tempC = (5.0 / 9.0) * (tempF - 32.0);
// display the output
// I don't want showpoint because I don't want to show a point!
cout.setf(ios::fixed);
cout.precision(0);
cout << "Celsius: " << tempC << endl;
return 0;
}
Part 2: Child tax credit
int main()
{
// prompt for stats
double income = getIncome();
int numChildren = getNumChildren();
// display message
cout.setf(ios::fixed);
cout.precision(2);
cout << "Child Tax Credit: $ ";
if (qualify(income))
cout << 1000.0 * (float)numChildren << endl;
else
cout << 0.0 << endl;
return 0;
}
Part 3: Cookie monster
void askForCookies()
{
// start with no cookies :-(
int numCookies = 0;
// loop until the little monster is satisfied
while (numCookies < 4)
{
cout << "Daddy, how many cookies can I have? ";
cin >> numCookies;
}
// a gracious monster to be sure
cout << "Thank you daddy!\n";
return;
}
Valora esta pregunta


0