Okay, so I came across this problem while coding, and i though it might be useful showing it to everyone else.
So tell me what the problem is, and how to fix it.
HINT: The program compiles fine, so it couldn't tell you where the problem is
EDIT:Before, i accidently solved my problem, but now its broken, like it should be. Before looking at c++'s solution, just take a look at the code first, and guess, then look.
- Code: Select all
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string name;
int age;
string address;
cout << "\nEnter your name\n";
cin >> name;
cout << "\nNow enter your age\n";
cin >> age;
cout << "\n Good, now enter your address, including street number\n";
cout << "(Example. 23 Maple Lane)\n";
getline( cin, address);
cout << "\nYou, " << name << ", are " << age << " years old, and you live on " << address << ".";
char f;
cin >> f;
}
If you really can't get it, try running the program
