1 2 2
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a=1;
printf("%i %i %i",a ,++a ,a++);
return 0;
}
But the output is :-
3 3 1
Please clear my doubts.




Posted 01 October 2012 - 12:17 AM
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a=1;
printf("%i %i %i",a ,++a ,a++);
return 0;
}
Posted 01 October 2012 - 12:27 AM
karank6195, on 01 October 2012 - 12:47 PM, said:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a=1;
printf("%i %i %i",a ,++a ,a++);
return 0;
}
Posted 01 October 2012 - 12:30 AM
Posted 01 October 2012 - 02:51 AM
raghav.naganathan, on 01 October 2012 - 09:27 AM, said:
This post has been edited by sepp2k: 01 October 2012 - 02:48 AM
Posted 01 October 2012 - 02:55 AM
sepp2k, on 01 October 2012 - 03:21 PM, said:
raghav.naganathan, on 01 October 2012 - 09:27 AM, said:
Posted 01 October 2012 - 02:59 AM
Posted 01 October 2012 - 03:05 AM
Posted 01 October 2012 - 03:51 AM
Posted 03 October 2012 - 12:33 AM
Posted 03 October 2012 - 07:43 AM
This post has been edited by AKMafia001: 03 October 2012 - 07:44 AM
Posted 03 October 2012 - 08:14 AM
Posted 04 October 2012 - 06:27 AM
Posted 06 October 2012 - 07:25 AM
Quote
#include<iostream.h>
#include<conio.h>
class Counter
{
private:
int cv;
public:
Counter() // Zero Argument Constructor
{
cv=5;
cout<<"Counter Initial Value "<<cv<<endl;
}
void operator ++() // Overloading of ++ operator for-
{ // -Prefix Notation.
++cv;
}
void operator ++(int) // Postfix Notation.
{
cv++;
}
void operator --() // Overloading of -- operator for-
{ // -Prefix Notation.
--cv;
}
void operator --(int) // Postfix Notation.
{
cv--;
}
void showCounter() // For Display.
{
cout<<"Current value "<<cv<<endl;
}};
void main()
{
clrscr();
Counter counter;
++counter;
counter.showCounter();
counter++;
counter.showCounter();
--counter;
counter.showCounter();
counter--;
counter.showCounter();
getch();
}
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
