Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
C
#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>
using namespace std;

int main();

string username,password,un,pw;
//string username,password
{
    int choice;   
    cout<<"1: Registration\n2: Login\nYour choice: " ;
	cin>>choice;
	
    if (choice ==1)
    {
    	cout<<"Select a username: " ;cin>>username;
     	cout<<"Select a pssword: " ;cin>>password;	
	}	
	else if (choice == 2)
	{		
	 if (username == un && password == pw)
	{
		return true;
	}
    else
    {
    	return false;
	}
				
	}
}


What I have tried:

Try To fine what exactly the error but not get it.
pls help
Posted
Updated 7-Oct-18 3:06am
v2
Comments
Patrice T 7-Oct-18 8:31am    
and the line number is ?

1 solution

C++
#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>
using namespace std;

int main();  // 1) no ';' here
// 3) here
string username,password,un,pw;
//string username,password
{  // 2) the '{' goes at 3)
	int choice;
	cout<<"1: Registration\n2: Login\nYour choice: " ;
	cin>>choice;

	if (choice ==1)
	{
		cout<<"Select a username: " ;cin>>username;
		cout<<"Select a pssword: " ;cin>>password;
	}
	else if (choice == 2)
	{
		if (username == un && password == pw)
		{
			return true;
		}
		else
		{
			return false;
		}

	}
}

read comments in number order. 1 2 3
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900