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

Recommended Answers

All 12 Replies

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

Strike that, just IM me on Fingerkid321.

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

Pop-Quiz -

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

Result = ?

Explane your awser.

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.

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.

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

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

#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;
}
#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 an int double?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.