Start New Discussion within our Software Development Community

I'm currently trying to create a program which factorises a number entered by the user, as reccomended by the sticky. When I run the program, I get "error C2061: syntax error : identifier 'cin'".

Here is my code:

#include <iostream>

using namespace std;

int main() {
	int iFigure;
	int iFigureTwo;
	cout << "Enter the number that you would like to factorise. " << endl;	
	cin >> iFigure;
	iFigureTwo = iFigure - 1;
	do while(iFigureTwo <= iFigure) {
	iFigureTwo + (iFigureTwo + 1); 
	iFigureTwo = iFigureTwo + 1; }


Also, please don't try to help me with the actual program as a whole, just the error I'm getting.


Your do..while statemen is wrong (so you are getting the error at line 15 I guess, not at 9 where you are also using cin). This indicates that cin itself isn't the problem, but something closely before the line where the error is.

A do/while is written like:

} while( condition );  //<-- don't forget the ; here
This question has already been answered. Start a new discussion instead.