Error C2015
Contents |
Languages , Windows Desktop Development > Visual C++ Question 0 Sign in to vote #include
Error C2440
cin>>answer; if (answer='water'||'Water') cout<<"Correct"; else if (answer!='water'||'Water') cout<<"Sorry"; cout<<"Do you want to play too many characters in constant c++ again?"; } while (repeat=='Yes'); return 0; } //I'm trying to create a program to help someone learn English but C++ keeps giving me Error C2015 where I have the correct answers. Wednesday, July 31, 2013 9:28 PM Reply |
Too Many Characters In Character Constant C
Quote Answers 0 Sign in to vote Are you comparing int with string ? Second thing instead of = use == . third '' used for character and water etc is not a character. There are plenty of mistake look carefully what are you doing. Thanks Rupesh Shukla Edited by Pintu Shukla Wednesday, July 31, 2013 9:31 PM Proposed as answer by Pintu Shukla Thursday, August 01, 2013 2:05 PM Marked as answer by Anna CcMicrosoft contingent staff Wednesday, August 07, 2013 9:30 AM c2015 moe Wednesday, July 31, 2013 9:30 PM Reply | Quote 0 Sign in to vote #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more
C2105
about Stack Overflow the company Business Learn more about hiring developers or posting ads
C++ String
with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up c++ error c2015: too many characters in constant up vote -2 down https://social.msdn.microsoft.com/Forums/vstudio/en-US/f9738008-6355-492f-94d3-08cceb9c2883/c-error-c2015-too-many-characters-in-constant?forum=vcgeneral vote favorite Sorry if it's something simple, but I'm new to C++ and haven't really gotten a good hold on it, yet. I need to build a calculator whose only named variables are pointers, and this is what I have so far, but I keep getting errors and I can't figure out why. Every error that always related to my if construct, though. int main() { //Creating variables //Values to http://stackoverflow.com/questions/25791306/c-error-c2015-too-many-characters-in-constant perform operations on float *aptr = new(nothrow)float; float *bptr = new(nothrow)float; float *ansptr = new(nothrow)float; int *endptr = new(nothrow)int; char *operationptr = new(nothrow)char; cout << "Simple Operation Calculator" << endl; //Displays program name cout << "Performs +, -, *, or / on any two real operands." << endl; //Describes nature of program to user *endptr = 1; while(*endptr = 1) //Creates a loop so that the user may perform as many operations as desired { //Prompts the user for the first operand cout << "First operand: " << endl; cin >> *aptr; //Prompts user for operator cout << "Operator(+,-,*,/): " << endl; cin >> *operationptr; //Prompts user for second operand cout << "Second operand: " << endl; cin >> *bptr; //Performs requested operation if(*operationptr == '+' || *operationptr == 'plus') { *ansptr = *aptr + *bptr; } else if(*operationptr == '-' || *operationptr == 'minus') { *ansptr = *aptr - *bptr; } else if(*operationptr == '*' || *operationptr == 'times') { *ansptr = *aptr * *bptr; } else if(*operationptr == '/' || *operationptr == 'divided by') { if(*bptr = 0) { cout << "Cannot divide by zero. Terminating program." << endl; *endptr = 2; break; } *ansptr = *aptr / *bptr; } else { cout
1 of 1 New Topic/Question Reply 9 Replies - 19813 Views - http://www.dreamincode.net/forums/topic/31961-error-c2015-too-many-characters-in-constant/ Last Post: 21 August 2007 - 03:48 PM Rate Topic: #1 requiem78 New D.I.C Head Reputation: 0 Posts: 9 Joined: 15-August 07 error C2015: too many characters in constant Posted 20 August 2007 - 10:27 AM Hi.This is my code until now. #include