Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 #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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago