jeudi 5 mars 2015

How To Make cin Start A New Line


I was wondering how to make cin start a new line after the semi colon. I've tried to use >> endl, << endl and \n after the variable. The code I used is:



#include "stdafx.h"
#include "iostream"
#include "string"
using namespace std;

int main()
{
cout << "Enter two positive numbers and this program will tell you which one is larger." << endl;
int firstNumber, secondNumber;
string whichIsGreater;
cin >> firstNumber;
cin >> secondNumber;

whichIsGreater = firstNumber > secondNumber ? firstNumber + " is greater." : secondNumber + "is greater.";
cout << whichIsGreater << endl;
return 0;
}


Hope you can give me a suggestion!


Thank you!




Aucun commentaire:

Enregistrer un commentaire