Hey, I'm new to programming in C++

So I just got done writing this and everything seems fine to me, but I got an errors. I've had many problems with compilers in the past, but I'm not sure if this is from the code or the compiler.

If it helps I'm running Windows7 64bit and using DevC++ (mingw)

#include <iostream>
using namespace std;

int main ()
{

int a;
int b;

cout << "lets add numers, enter you first number";
cin >> a;
cout << "enter your second number";
cin >> b;
cout >> (a + b);

return 0;
}

This is the problem

\test.cpp In function `int main()':
\test.cpp no match for 'operator>>' in 'std::cout >> (a + b)'
\Makefile.win [Build Error] [test.o] Error 1

I've scanned through it many times, but I still cant figure out whats wrong. Did I do anything wrong?

I found out what I did wrong, you can go ahead and delete this ^_^

Recommended Answers

All 4 Replies

Look closer at line #14:

cout >> (a + b);

you're using the wrong operator. Use cout << instead of cout >>

you're using the wrong operator. Use cout << instead of cout >>

Yeah, already seen and fixed this.

Not in the code you posted. I'm not clairvoyant you know :icon_wink:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.