C++ Strange Login error

#include <iostream>
#include <string>

int main() {
std::string const username;
std::string const password;
std::string const usern;
std::string const passw;

std::cout<<"Welcome User"<<std::endl;
std::cout<<"This is a login page";
std::cout<<"Fill in the details"<<std::endl;
std::cout<<"Create a username: ";
std::cin>>username;








}
what's the problem????
Error: cannot bind 'std::istream
The message is strange but the problem is that username is const (why?) so you can't read into it.
username is const so it cant be changed
Thomas1965 - Problem is fixed, I shouldn't have put the username as const
closed account (E0p9LyTq)
If you want username to be const and unchangable, create a temp string to get the input and then create yourname using the temp string as input.
#include <iostream>
#include <string>

int main() {
std::string username;
std::string const password;
std::string const usern;
std::string const passw;

std::cout<<"Welcome User"<<std::endl;
std::cout<<"This is a login page"<<std::endl;
std::cout<<"Fill in the details"<<std::endl;
std::cout<<"Create a username: ";
std::cin >> username;
std::cout<<"Username is "<<username<<std::endl;
std::cout<<"Create Password: ";
std::cin >> const password;


}


This problem comes up
error: expected primary-expression before 'const'
std::cin >> *const password;
^~~~~
Topic archived. No new replies allowed.