954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Unary Operators

Can someone explane to me how prefixs and postfixs are used and how they work. :o

Marilyn_Manson
Newbie Poster
6 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

Please help me. Can someone just IM me. PrejudiceWorid2 (AIM). Please!

Marilyn_Manson
Newbie Poster
6 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

Strike that, just IM me on Fingerkid321.

Marilyn_Manson
Newbie Poster
6 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

Please don't double post. Someone knowledgable in what you're asking will get to you as soon as they can.

cscgal
The Queen of DaniWeb
Administrator
19,422 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 230
 

Pop-Quiz -

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

Result = ?

Explane your awser.

Marilyn_Manson
Newbie Poster
6 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

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.

Chainsaw
Posting Pro in Training
436 posts since Jun 2004
Reputation Points: 36
Solved Threads: 11
 

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.

Marilyn_Manson
Newbie Poster
6 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

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
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;
}

Marilyn_Manson
Newbie Poster
6 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

Make sure there's only one function called 'main' in your program.
Delete *.obj and then compile again.

Luna
Newbie Poster
1 post since Jul 2004
Reputation Points: 10
Solved Threads: 0
 
#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;
}
meabed
Junior Poster
Team Colleague
139 posts since May 2004
Reputation Points: 55
Solved Threads: 3
 
#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;
}

What is anint double?

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

lol, DUH!

Blah Blah Blah

.·)Tusky(·.
Newbie Poster
8 posts since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

Tusky, please don't post nonsense posts. Thanks.

cscgal
The Queen of DaniWeb
Administrator
19,422 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 230
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You