What is going on here? PLEASE HELP!

I know the code is not quite done but even before then I am having errors I have never had before when working with functions or simple as !=. All of my !='s are erroring out saying that they are not operators that visual studio 2010 knows about. and the first brace of my functions are getting a missing header error that i was not getting before today.

HERE ARE THE ERRORS VISUAL STUDIO PROVIDED:

1>c:\users\nick\documents\visual studio 2010\projects\mp5\mp5\mp5.cpp(9): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\nick\documents\visual studio 2010\projects\mp5\mp5\mp5.cpp(14): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\nick\documents\visual studio 2010\projects\mp5\mp5\mp5.cpp(19): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\nick\documents\visual studio 2010\projects\mp5\mp5\mp5.cpp(40): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\nick\documents\visual studio 2010\projects\mp5\mp5\mp5.cpp(63): error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error(425): could be 'bool std::operator !=(const std::error_code &,const std::error_condition &)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error(432): or 'bool std::operator !=(const std::error_condition &,const std::error_code &)'
1> while trying to match the argument list '(std::string, char)'
1>c:\users\nick\documents\visual studio 2010\projects\mp5\mp5\mp5.cpp(63): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>

Sorry for the mess, I just dont want to leave anything out :3


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
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

enum eType {Sub, Trans, Del, Insert, Err, Corr};

void get_cWord(ifstream& fin, string cWord);
{
	fin >> cWord
}

void get_bWords(ifstream& fin, string bWords);
{
	fin >> bWords
}

void display(eType e);
{
	switch(e)
	{
	case Sub: cout << "User word is " << bWords << endl
				   << "The user word has one character substituted" << endl << endl << break;

	case Trans: cout << "User word is " << bWords << endl
				     << "The user word contains a transpostion" << endl << endl << break;

	case Del: cout << "User word is " << bWords << endl
				   << "The user word has one character delected" << endl << endl << break;

	case Insert: cout << "User word is " << bWords << endl
				      << "The user word has one character inserted" << endl << endl << break;
	case Err: cout << "The user word is to bad to be a misspelling" << endl << endl << break;
	case Corr: cout << "The user word is Correct" << endl << endl << break;
	}
}


void findeType(eType e);
{
	if(cWord == bWord)
	{
		e = Corr
	}else if(cWord == bWord+1)
	{
		e = Del
	}else if(cWord == bWord-1)
	{
		e = Insert 
	}
}




void main()
{
	ifstream fin;
	string cWord = "", bWords = "";
	eType e = Corr;


	while(cWord != '\n')
	{
		get_cWord(fin, cWord);

		cout << "The word being checked is " << cWord << "." << endl << endl;

		while(bWords != '\n')
		{
			get_bWords(fin, bWords);
			findeType(e);
			display(e);
		}

	}

	system("pause");
}
Last edited on
Remove all of the semicolons at the end of those lines. You are also missing semicolons in get_cWord and get_bWords.
Last edited on
1
2
void get_cWord(ifstream& fin, string cWord); // don't close your functions there with ";"
 


You declare the functions then tell the compiler with ";" stop here function declaration finished.

This results in your code afterwards :
1
2
3
{
fin >> cWord
}

to be loose and not to belong to anything
That's confusing the poor compiler ^.^

Ninja edit:
1
2
3
4
while(cWord != '\n') // don't think this works either (there is no overload of operator!= that
// compares a string and a char
// just write this:
while(cWord != "\n")
Last edited on
You need to compare a string with a string, double quotes, not single.
Try changing cWord != '\n' to cWord != "\n"
Last edited on
Thank you guys! I need to invest more time in sleeping XD
Topic archived. No new replies allowed.