hey guy I need help on finishing this project on c++ .. the problem I am having right now is that the output doesn't clear so all the information stays on even after the person has entered their password and name .. I want it to disappear after you press enter.. here's my code
#include "stdafx.h"
#include<string>
#include<conio.h>
#include<iostream>
#include<sstream>
usingnamespace std;
void User_name()
{
cout<<"Enter your name for the account:";
string account_name;
cin>>account_name;
}
void User_password()
{
cout<<"Enter your password: ";
string account_psw;
cin>>account_psw;
}
int _tmain()
{
cout<<"WE ARE GOING TO SET UP YOUR NAME AND PASSWORD\n"<<endl;
cout<<"What is your name ?: "<<endl;
string personame;
cin>> personame;
cout<<"Hello"<<" "<<personame<<endl;
User_name();
User_password();
0
_getch();
return 0;
}
Besides a random 0 on line 33 and the deprecated and nonstandard conio.h header along with its _getch() function, there is nothing wrong with the code... I suppose avoiding "using namespace std" would be a good tip to thrown in for future references.
There is nothing in your code that would clear the screen. Luckily for you, Duoas has written an entire article on the subject of clearing screens. http://www.cplusplus.com/articles/4z18T05o/