Quiz: Joining Text

This program should print Anna Smith, but it prints AnnaSmith. Click the line with the mistake.

#include <iostream>
#include <string>

int main() {
    std::string firstName = "Anna";
    std::string lastName = "Smith";
    std::string fullName = firstName + lastName;
    std::cout << fullName << "\n";
}

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

10/11