By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,659 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,659 IT Pros & Developers. It's quick & easy.

Why do i get this error: error C2297: '<<' : illegal, right operand has type 'const c

P: 2
#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
int d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, check_digit;

cout << "Enter 11 seperate digits\n";
cin >> d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11;
cout << d1 << " " << d2, d3, d4, d5, d6 << " " << d7, d8, d9, d10, d11;
check_digit=10-((3*(d1+d3+d5+d7+d9+d11)+d2+d4+d6+d8+d10)%10);
cout << "Check digit is " << check_digit;
return 0;




error occurs on line 15 (second line with cout)
Oct 7 '13 #1
Share this Question
Share on Google+
3 Replies


P: 94
Hi! I was able to compile your code successfully by substituting the commas (,) by >>s in the cin line, and by substituting the commas (,) by <<s in the second cout line.
Oct 7 '13 #2

P: 2
thank you very much i have this project due tuesday
Oct 7 '13 #3

P: 94
You're welcome! Don't forget to test it.
Oct 7 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.