Answer to Question #283127 in C++ for Rasheed Osman

Question #283127

Write the following program in c++.

Combine your first and second name and pick only the first five characters of your name for the project.

i. Declare an array named name1 and put all the first five characters into it.

ii. Write a for loop with an if condition that will find and output the index value of a

searched character in the array. Let the program be such that the user will input the character being searched for.


1
Expert's answer
2021-12-29T02:24:38-0500
#include <iostream>
using namespace std;

int main()
{
    string s1, s2, result;

    cout << "Enter string s1: ";
    getline (cin, s1);

    cout << "Enter string s2: ";
    getline (cin, s2);

    result = s1 + s2;

    cout << "Resultant String = "<< result;

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog