LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-16-2004, 10:45 PM   #1
smaida
Member
 
Registered: Apr 2004
Location: Richmond, VA - USA
Distribution: Debian
Posts: 62

Rep: Reputation: 15
c++ error C2105: '++' needs l-value


Hello,

First let me say that this is homework and I am asking for a general understanding of the probem as much if not more than I am asking for an answer.

I have a question that asks what is wrong with the following statement? Provide the code to accomplish what the user intended.

cout << ++( x + y );

I put the code in the compiler and I get the error "error C2105: '++' needs l-value". From the above code should I assume that someone is trying to display the value of x+y+1 or is this maybe some part of a loop? I am sure this is an easy questions but the book I have has let me to no real answer.

Secondly, I have a simple program that takes user input and does some basic calculations. Although it is not required at this point in the class I would like to validate the users data so that entering unexpected characters does not cause an error. At this time the program just assumes that the user will enter an integer. How would I go about verifying that a number is an integer? I know how to validate input in perl, but this seems different. Pointing me to a tutorial or a good source of online learning would be greatly appreciated.

Thanks,
Shawn
 
Old 07-17-2004, 12:56 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You want to read a definition of l-value to help you understand.

http://computing-dictionary.thefreed...ary.com/lvalue
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
updating new installation of 9.3 ERROR...ERROR...ERROR Morbid SUSE / openSUSE 3 08-15-2005 11:22 PM
Hard drive failure error? (sense key Medium error) Arodef Linux - Hardware 2 11-02-2004 12:39 PM
QMAIL error:554 Transaction failed: message format error mpk25 Linux - Software 1 10-15-2004 12:53 PM
NETPERF: ERROR --> send_udp_stream: error on remote: Interrupted system call dravya Linux - General 1 05-29-2004 05:49 PM
cdrecord inupt/output error. write_g1: scsi sendcmd: no error lucstuk Linux - Software 9 08-09-2003 09:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration