Many errors found

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

int main ()
{
	int C = 0;
	int G = 0;
	string seq = " ";
	char c = ' ';

	cout << "Enter a DNA sequence";
	cin >> sequence;

	while (seq >> c) { if(c != "A" || c ! ="T" || c! = "C" || c ! = "G")
		cout << "Not a DNA sequence";
		return 0;
	}
		if (c == "C") c++
		if (c == "G") g++
	}

{
	cout << c;
	cout << g;

	return 0;

}


and these are the errors I am getting.


Test1.cpp:9:2: error: expected ',' or ';' before 'string'
Test1.cpp:13:9: error: 'sequence' was not declared in this scope
Test1.cpp:15:9: error: 'seq' was not declared in this scope
Test1.cpp:15:28: error: ISO C++ forbids comparison between pointer and integer
Test1.cpp:15:37: error: expected ')' before '!' token
Test1.cpp:19:12: error: ISO C++ forbids comparison between pointer and integer
Test1.cpp:20:3: error: expected ';' before 'if'
Test1.cpp: At global scope:
Test1.cpp:23:1: error: expected unqualified-id before '{' token



so these are the errors that come up after I fixed the whole quotation mistake. Now I do not know what I have to do exactly.
Last edited on
I see different quotes in this statement

cout << Enter a DNA sequence;
Last edited on
so the errors are basically telling me to declare 'Enter' 'sequence' 'seq' 'A' 'Not' 'G' and 'g'. One thing I don't understand is that what I did for C is the same as what I did for G and C didn't come up as an error. And what do you mean different quotes?

Also how would I declared the rest of them? For the Enter sequence part, I just want it to display "Enter a DNA sequence", then it would take the sequence that the user would type in.
Last edited on
If you use a word processor for editing, it may add so-called "smart quotes" where the opening quote is visually different to the closing quote. And neither of them is the same character as the standard single and double quote, " and '

When programming, use a plain text editor (or one designed for writing code, such as notepad++).

You should be able to do a global change in the text editor, to replace the non-standard characters with ordinary quotes.
that could be why since I used Open Office to do the writing before actually compiling it. So does anybody find anything wrong with the program itself besides the quotes?
Last edited on
Change at first the quotes and do not take away the time of others!
Topic archived. No new replies allowed.