not understanding errors

solved
Last edited on
Here I think i solved them:
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
#include <iostream>
#include <cmath>

using namespace std;


void validset(int,int,int);
int main()
{
    int x,y,z;
    char answer;

    do  {
         cout <<    "Type in the first score" << endl;
         cin >> x;
         cout <<    "Type in the second score";
         cin >> y;
         cout <<    "Type in the third score";
         cin >> z;
         validset (x,y,z);
         cout <<    "Type c to continue; s to stop";
         cin >> answer;
         }while (answer == 'c');
         return 0;
)
void validset(int x, int y, int z)
{
    if (x < 0 || x > 300)
        cout << "The group is invalid";
    else if (y < 0 || y > 300)
        cout << "The group is invalid";
    else if (z < 0 || z > 300)
        cout << "The group is invalid";
    else
        cout << "The group is valid";
    return 0;
    }
You used (...) instead of {...} on line 13 and line 26.
Line 13,23: These should be curly braces, not parens. General ruile: expressions are surrounded by parens. statement blocks are surrounded by curly braces.

Line 25: This should be a curly brace, not a close paren.

Line 27,37: Again these should be {}, not ()

Line 36: Your can't return 0 on a void function. Since there is no meaningful return value, remove line 36.
Please do not remove your posts after getting an answer.
Original post:
Write your question here.
Many of my errors were in the main program saying that "expected '(' before ';' token"
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
  #include <iostream>
#include <cmath>

using namespace std;


void validset(int,int,int);
int main()
{
    int x,y,z;
    char answer;

    do  (
         cout <<    "Type in the first score" << endl;
         cin >> x;
         cout <<    "Type in the second score";
         cin >> y;
         cout <<    "Type in the third score";
         cin >> z;
         validset (x,y,z);
         cout <<    "Type c to continue; s to stop";
         cin >> answer;
         ) while (answer == 'c');
         return 0;
)
void validset(int x, int y, int z)
(
    if (x < 0 || x > 300)
        cout << "The group is invalid";
    else if (y < 0 || y > 300)
        cout << "The group is invalid";
    else if (z < 0 || z > 300)
        cout << "The group is invalid";
    else
        cout << "The group is valid";
    return 0;
    )
Registered users can post here. Sign in or register to post.