Should I be using putback for this??: You have to parse a user password input as
ID: 3800655 • Letter: S
Question
Should I be using putback for this??: You have to parse a user password input as shown in the following2017@NAME
into an integer, character and string output respectively. However the user input is @2017NAME, resulting a fail state in your program. Write an algorithm and C++ program by which you would get the input stream back in the buffer from failed state, confirm the order by sniffing the first character of input stream and output the parsed password back. Should I be using putback for this??: You have to parse a user password input as shown in the following
2017@NAME
into an integer, character and string output respectively. However the user input is @2017NAME, resulting a fail state in your program. Write an algorithm and C++ program by which you would get the input stream back in the buffer from failed state, confirm the order by sniffing the first character of input stream and output the parsed password back. Should I be using putback for this??: You have to parse a user password input as shown in the following
2017@NAME
into an integer, character and string output respectively. However the user input is @2017NAME, resulting a fail state in your program. Write an algorithm and C++ program by which you would get the input stream back in the buffer from failed state, confirm the order by sniffing the first character of input stream and output the parsed password back.
Explanation / Answer
#include<iostream>
#include<string>
#include<vector>
//header files
using namespace std;
int main()
{
std::cout<<"Please enter input";
//Give your password
float a;
//declaring
a=std::cin.get();
std::string str;
std::cin.putback(a);
//used for putback
std::cin>>a;
cin.getline(std::a,str);
//for getting input from user
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.