Ожидаемая ошибка без идентификатора в квадратных скобках

Это мой код:

16 using namespace std;
17
18 void printInOrder(string s1, string s2, string s3);
19
20 int main()
21 {
22        string  w1, w2, w3;             // input values
23
24        cin >> w1 >> w2 >> w3;          // read in three values
25        printInOrder(w1, w2, w3);       // function does not return anything
26
27        return 0;
28
29 }
30 //
31 // printInOrder() prints out the three words in alpha order
32 //                with spaces between them, no return value
33 //
34 void printInOrder(string x, string y, string z)
35 {
36        // your code here
37        // your function does NOT use return
38        // Instead, it sends values to cout
39        // Just print the 3 strings as described in the assignment
40        // with no extra stuff.
41
42        if (x<24 && y<20 && z<24)
43                cout << x, y, z << endl;
44
45                return;
46
47 }

И я продолжаю получать ошибку:

mid3.cpp:39:1: error: expected unqualified-id before ‘{’ token

Не могу понять, что не так !!

Спасибо!

-1

Решение

в строке 42 вы должны поместить каждое условие в (), и я не знаю, почему вы сравниваете строки с целыми числами!
в строке 43 вы должны написать:

cout << x << y << z << endl;
1

Другие решения


По вопросам рекламы ammmcru@yandex.ru
Adblock
detector