Program Preprocessor variable postfix , C/C++ Programming

Run the following C++ program with and without preprocessor variable POSTFIX defined.

#include

using namespace std;

extern "C" int atoi( const char *str );

struct Node {

int i, j, k;

Node() {}

};

int main( int argc, char *argv[ ] ) {

int times = 10000;

switch ( argc ) {

case 2:

times = atoi( argv[1] );

} // switch

vector v( 10000 );

vector::iterator vi;

volatile int j = 0; // ignore, prevent loop elimination

for ( int i = 0; i < times; i += 1 ) {

for ( vi = v.begin(); vi != v.end();

#ifdef POSTFIX

vi ++

#else

++ vi

#endif

) {

j += 1; // ignore, prevent loop elimination

}

}

}

Posted Date: 3/2/2013 2:13:54 AM | Location : United States







Related Discussions:- Program Preprocessor variable postfix , Assignment Help, Ask Question on Program Preprocessor variable postfix , Get Answer, Expert's Help, Program Preprocessor variable postfix Discussions

Write discussion on Program Preprocessor variable postfix
Your posts are moderated
Related Questions
Operation on String - C ++ Program: Write a program to define operations on string in c++. class String {    char *char_ptr;   // pointer to string contents    int le

write a c++ code to implement use of a constructor

string will contain only lower case alphabet& the ascii value starts from 1-26,(ie,a=1&z=26).it perform the operation like the following costs:add=2units,replace=1unit,delete=3unit

Create a class  called  ticketSelling that stores booking information of a single performance on a single day and sells the tickets of the performance. The class should include at

The #undef Directive This directive undefines a previously explained macro. For, example the following will give an error since PI is undefined.                 #define PI 3

A: No. There is nothing you can do in C++ which you cannot do in C. In spite of everything

What if one forget the [] when deleteing array allocated through new T[n]? A: All life comes to a disastrous end. It is the programmer's responsibility not the compiler's to

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Both malloc & new functions are utilized for dynamic memory allocations & the basic difference is: malloc need a special "typecasting" while it allocates memory for eg. if the poin

what is the difference between call by reference and call by pointer method?