Much appreciated to anyone to lend me a clue. I've been at this exercise for a few hours and cannot figure out why it will not compile. I've specified the problem the compiler says is the problem below. The problem is next to //HERE. The compiler "(codeblocks)" says "no match for 'operator>>' ". Can someone please show me what is wrong. Thanks.
This exercise is from a c++ programming book "From program analysis to program design"....The exercise says to write a program that mimics a calculator ,only (+, -, / ,*). I just wanted to go a little farther and include the modulus sign and that is where the problem comes in.
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
double num1, num2, sum, difference, product, quotient;
int remainder, modulus1, modulus2;
char instrument, main;
cout << "C or c for regular calculator. M or m for modulus calculator.";
cin >> main;
I don't think cin automatically adds a new line. I believe it just happens to be a side effect of pressing the Enter key after your input. I might be wrong with that since I don't know the actual workings of cin, but I believe that new line character can end up getting stored into the buffer stream if you're not careful. That's what makes me believe that cin doesn't typically just add a new line.