giving a semicolon error

okay, I have searched through my code, and I have absolutely no Idea why this is telling me that it needs a semicolon, or a comma before token {

it throws this error upon compilation

/home/alex/Projects/cppt/src/cppt1.cpp|27|error: expected ‘,’ or ‘;’ before ‘{’ token|
||=== Build finished: 1 errors, 0 warnings ===|


in this code

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
//============================================================================
// Name        : cppt1.cpp
// Author      : Alex Herrmann
// Version     :
// Copyright   : 2011, crappy program!!
// Description : Hello World test programs in C++, Ansi-style
//============================================================================

#include <iostream>
#include <string>
using namespace std;
#define VER "0.0.0.a1 Pre-Alpha"
#define SEP " <-> "
int anm; //a nname variable, to count down from
int anmi; //name variable for isvalidmem
int anmc; //name variable for countdown
int a = 15; //Alex
int n = 12; //Natalie
int j = 11; //Johnny
int d = 42; //Dad
int m = 39; //Mom




int isvalidmemi (anmi)
{ //it gives error before this line

    if (anmi == 'a' || 'A')
    {
        anm = a;
        break;
    }
    else if (anmi == 'n' || 'N')
    {
        anm = n;
        break;
    }
    else if (anmi == 'j' || 'J')
    {
        anm = j;
        break;
    }
    else if (anmi == 'd' || 'D')
    {
        anm = d;
        break;
    }
    else if (anmi == 'm' || 'M')
    {
        anm = m;
        break;
    }
    else
    {
        cout << "are you stupid!!! i said you could pick >one< from >those< numbers"
         }
         countdown(anm);
}

int countdown (anmc)
{
    int ac = a;
    bool ishigher; //a boolean that tells us if it is higher or not
    if anmc > a
{
    ishigher = true
}
else if anmc < a
{
    ishigher = false
}

}

int main()
{
    cout << "----------\n";
    cout << "Hello World!!!\n"; // prints !!!Hello World!!!
    cout << "----------\n";
    int a = 15;
    int n = 12;
    int j = 11;
    int d = 42;
    int m = 39;

    cout << a << SEP << n << SEP << j << SEP << d << SEP << m << "\n";
    cout << "that is my family members ages!!! \n";
    int theirage;
    cout << "what is your age?!?:  ";
    cin >> theirage;
    cout << theirage << "\n";
    string aage = (theirage < a ? "little Baby!!" : "old fart...");
    cout << aage;

    cout << "lets do that again, \nbut this time we will use \\ a <sstream> \\\nor a string stream";

    /* this next section makes use of several awesome things that c++ does*/

    string m1;
    int m1i;
    string m2;
    int m2i;

    cout << "please enter one of the following letters; a n j d m : ";
    cin >> m1;
    cout << endln;
    cout << "and agaiSn please: ";
    cin >> m2;
    cout << endl;
    isvalidmemi(m1);
    isvalidmemi(m2);


    return 0;
}



I have no Idea why this will not compile.
If statements don't need a break.

Never seen
1
2
int anmi;
int isvalidmemi (anmi)


The following works just fine.
 
int isvalidmemi (int anmi)


However you seem to be putting a string into a int with isvalidmemi

Missing ; on line 27


You're also declaring this twice for no reason inside main
1
2
3
4
5
    int a = 15;
    int n = 12;
    int j = 11;
    int d = 42;
    int m = 39;


@OP
I have no Idea why this will not compile.

read this: http://www.cplusplus.com/doc/tutorial/functions/

line 26&61: wrong way to write function definition (the explanation is in the link)
line 29/34/39 etc. : comparison of two different types
line 56&67&71&etc: missing semicolon ';' - we need one after each statements
line 58: calling a function without a declaration

Thank you So much, compiling fine now!!
sorry about my terrible formatting, I was trying all sorts of different things to get it to work, and in the end, I probably just screwed myself over with all the unnecessary code!
Topic archived. No new replies allowed.