HW Help

Hello guys, I'm having trouble with my project.
When I compile the program I get "expected unqualified-id
{"
How do I fix this problem?
Here's my code below

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
int main ();
{
        string inputFilename;
        string outputFilename;
        string line;

        ifstream        infile;
        ofstream        outfile;

        cout << "Enter input file name: ";
        cin >> inputFilename

        infile.open(inputFilename.c_str());
        if (!infile) {
                cerr << inputFilename << " not found" << endl;
                exit (0);
        }

        cout << "Enter output file name: ";
        cin >> outputFilename;

        outfile.open(outputFile.c_str());
        if (!outfile) {
                cerr << "unable to create " << outputFilename << endl;
                exit(0);
        }

        string ss;
        cin >> ss;

        while (getline(infile line)) {
                for (int i = 0; i < line.length(); i++) {

                        for (int x = 0; x < ss.length(); x++) {
                                if (line.at(i) = '*';
                                        outfile << ss.length(x);
                                else
                                        outfile << ' ';
                                }
                        }
                outfile << endl;

        }
        infile.close();
        outfile.close();

        return 0;
}
int main (); // Random semicolon is random

cin >> inputFilename // missing semicolon

outfile.open(outputFile.c_str()); // outputFile doesnt exist?

while (getline(infile line)) { // missing coma between infile and line

That's a few of them.
Last edited on
shoot! thanks i fixed that now it works
Topic archived. No new replies allowed.