Why is the result/remainder not shown.

I can input number1 and number2, however the result or remainder is not shown. I've seen the word "buffer" thrown around in places with regard to cout cin, but I have no idea what it really means or when it needs to be implemented. Or maybe that isn't even the problem.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
using namespace std;

int main()
{
	long number1;
	long number2;
	cin >> number1;
	cout << number1 << " divided by ";
	cin >> number2;
	cout << (number1/number2) << " Remainder " << (number1%number2);





	return 0;
}
Last edited on
Well, you don't have a newline character at the end so the output might end up on the same line as whatever gets printed after your program has ended.
Last edited on
It appears using visual studios default headers fixed the issue. It now shows the remainder as intended, I just have to run without debugging to ensure I can actually read the result.
[code]
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
using namespace std;

int main()
{
long number1;
long number2;
cin >> number1;
cout << number1 << " divided by ";
cin >> number2;
cout << (number1 / number2) << " Remainder " << (number1%number2);





return 0;
}
[code]
Topic archived. No new replies allowed.