problem with test

line 12 error: empty character constant
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string>
#include <iostream>

using namespace std;

int main ()
{
    cout << "Please enter your first name and last name\n";
    string first;
    string second;
    cin >>first>>second;
    cout << "Hello," <<first<< '' <<second<< "\n";
    return 0;
}

You probably just need to put a space ' ' between your ' characters.
very very new to C++
i typed in the test instead of copy and paste them to try to learn it better, and i don't understand what you mean?
Last edited on
 
out << "Hello," <<first<< '' <<second<< "\n";


Here you try to print an empty character, which causes a compiling error. '' is different from ' ' (with space), because a space character is actually a character which can be printed.
ok disregard last post
very very new to C++
i typed in the test instead of cop and pasting it to attempt to learn better, but i dont understand what you mean?
It's about this specific bit:

first<< '' <<second

Here you try to print an empty character, which causes a compiling error. '' is different from ' ' (with space).
ok that worked....took me awhile to figure it (palm on forehead)
Last edited on
ok thanks i originally thought whitespace didnt matter at all is what i had read. i feel like i am entering a whole new world that i keep scratching my head and taking small breaks to avoid headaches lol Any chance of my other question http://www.cplusplus.com/forum/beginner/46883/
Last edited on
Topic archived. No new replies allowed.