C++ String Question

Introduction

Write a program that defines two strings.

Join them together and assign the result to a third-string.

Print out the value of the resulting string.

You can use the following code structure.

#include <iostream> 

int main() 
{ 
    //your code here
} 



#include <iostream> 
#include <string> 

int main() 
{ 
    std::string s1 = "Hello"; 
    std::string s2 = " World!"; 
    std::string s3 = s1 + s2; 
    std::cout << "The resulting string is: " << s3; 
} 



PreviousNext

Related