Question
Write a single statement that assigns to the variable uname a string consisting of the first character in the user's first name plus the first
Write a single statement that assigns to the variable uname a string consisting of the first character in the user's first name plus the first 4 characters of their last name. Assume the user will have 2 or more names. Do not change the case of any character (e.g., upper case to lower case). Use the functions rfind, substr, and the + operator.
BELOW is the given code.
#include
using namespace std;
int main() { string fullname, uname; cout << "Enter your full name:" << endl; getline(cin, fullname); //your solution goes here
cout << "Username: " << uname << endl; return 0; }
PLEASE DO IT CORRECTLY.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started