943,808 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 5897
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 24th, 2004
0

Unary Operators

Expand Post »
Can someone explane to me how prefixs and postfixs are used and how they work. :o
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Marilyn_Manson is offline Offline
6 posts
since Jul 2004
Jul 24th, 2004
0

Re: Unary Operators

Please help me. Can someone just IM me. PrejudiceWorid2 (AIM). Please!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Marilyn_Manson is offline Offline
6 posts
since Jul 2004
Jul 24th, 2004
0

Re: Unary Operators

Strike that, just IM me on Fingerkid321.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Marilyn_Manson is offline Offline
6 posts
since Jul 2004
Jul 24th, 2004
0

Re: Unary Operators

Please don't double post. Someone knowledgable in what you're asking will get to you as soon as they can.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Jul 24th, 2004
0

Re: Unary Operators

Pop-Quiz -

int Result, A, B;
A = 4;
B = 23;
Result = 9 + (A++ - --B) * B

Result = ?

Explane your awser.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Marilyn_Manson is offline Offline
6 posts
since Jul 2004
Jul 24th, 2004
0

Re: Unary Operators

prefix notation like --B does the operation BEFORE using the value in an expression, (pre as in do it before), whereas postfix like A++ does the operator AFTER using the value in the expression (post as in after).

In your expression above, you should 'play compiler' and see what gets computed FIRST, then what gets computed NEXT, and so on.
Reputation Points: 36
Solved Threads: 11
Posting Pro in Training
Chainsaw is offline Offline
436 posts
since Jun 2004
Jul 24th, 2004
0

Re: Unary Operators

I still don't understand, what is the operation? What expression?

Can someone just show me steop by step how to do the above problem?I'm not good with words. I'm better visualy.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Marilyn_Manson is offline Offline
6 posts
since Jul 2004
Jul 24th, 2004
0

Re: Unary Operators

Hello, I'm trying an exercise. For some reason it's not working. There is a regualr error and one fatal errors.

-Error LNK2005: _main already defined in Conditional_Operators.obj.
-Fatal error LNK1169: one or more multiply defined symbols found.

The code:

#include <iostream>
using namespace std;

double Square (double Value);

main ()
{
double Number, SquaredNumber;
Number = 5;
SquaredNumber = Square (Number);
cout << SquaredNumber << endl;
return 0;
}

double Square (double Value)

{
double SquareReturn;

SquareReturn = Value * Value;

return SquareReturn;
}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Marilyn_Manson is offline Offline
6 posts
since Jul 2004
Jul 24th, 2004
0

Re: Unary Operators

Make sure there's only one function called 'main' in your program.
Delete *.obj and then compile again.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Luna is offline Offline
1 posts
since Jul 2004
Jul 25th, 2004
0

Re: Unary Operators

#include <iostream>
using namespace std;

int double Square (double Value);

int main ()
{
double Number, SquaredNumber;
Number = 5;
SquaredNumber = Square (Number);
cout << SquaredNumber << endl;
return 0;
}

int double Square (double Value)

{
 double SquareReturn;

SquareReturn = Value * Value;

return SquareReturn;
}
Team Colleague
Reputation Points: 55
Solved Threads: 3
Junior Poster
meabed is offline Offline
139 posts
since May 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Unary operators
Next Thread in C++ Forum Timeline: Error C2734: 'Value' : const obje





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC