Unary Operators

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2004
Posts: 6
Reputation: Marilyn_Manson is an unknown quantity at this point 
Solved Threads: 0
Marilyn_Manson Marilyn_Manson is offline Offline
Newbie Poster

Unary Operators

 
0
  #1
Jul 24th, 2004
Can someone explane to me how prefixs and postfixs are used and how they work. :o
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 6
Reputation: Marilyn_Manson is an unknown quantity at this point 
Solved Threads: 0
Marilyn_Manson Marilyn_Manson is offline Offline
Newbie Poster

Re: Unary Operators

 
0
  #2
Jul 24th, 2004
Please help me. Can someone just IM me. PrejudiceWorid2 (AIM). Please!
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 6
Reputation: Marilyn_Manson is an unknown quantity at this point 
Solved Threads: 0
Marilyn_Manson Marilyn_Manson is offline Offline
Newbie Poster

Re: Unary Operators

 
0
  #3
Jul 24th, 2004
Strike that, just IM me on Fingerkid321.
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,040
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 127
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: Unary Operators

 
0
  #4
Jul 24th, 2004
Please don't double post. Someone knowledgable in what you're asking will get to you as soon as they can.
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 6
Reputation: Marilyn_Manson is an unknown quantity at this point 
Solved Threads: 0
Marilyn_Manson Marilyn_Manson is offline Offline
Newbie Poster

Re: Unary Operators

 
0
  #5
Jul 24th, 2004
Pop-Quiz -

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

Result = ?

Explane your awser.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 436
Reputation: Chainsaw is an unknown quantity at this point 
Solved Threads: 10
Chainsaw's Avatar
Chainsaw Chainsaw is offline Offline
Unprevaricator

Re: Unary Operators

 
0
  #6
Jul 24th, 2004
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 6
Reputation: Marilyn_Manson is an unknown quantity at this point 
Solved Threads: 0
Marilyn_Manson Marilyn_Manson is offline Offline
Newbie Poster

Re: Unary Operators

 
0
  #7
Jul 24th, 2004
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 6
Reputation: Marilyn_Manson is an unknown quantity at this point 
Solved Threads: 0
Marilyn_Manson Marilyn_Manson is offline Offline
Newbie Poster

Re: Unary Operators

 
0
  #8
Jul 24th, 2004
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;
}
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 1
Reputation: Luna is an unknown quantity at this point 
Solved Threads: 0
Luna's Avatar
Luna Luna is offline Offline
Newbie Poster

Re: Unary Operators

 
0
  #9
Jul 24th, 2004
Make sure there's only one function called 'main' in your program.
Delete *.obj and then compile again.
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 141
Reputation: meabed is on a distinguished road 
Solved Threads: 3
Team Colleague
meabed's Avatar
meabed meabed is offline Offline
Junior Poster

Re: Unary Operators

 
0
  #10
Jul 25th, 2004
#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;
}
Real Eyes Realize Real Lies
My Resume
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC