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
This program requires the use of a windows box, no console applications are allowed. Prepare for Christmas now.  Each year, Reindeer Gift Emporium publishes a Christmas price list

What does throw; (with no exception object after the throw keyword) mean? Where would I employ it? A: You should see code that looks something like this: class MyException

We are now quite happy to use the basic mathematical expressions, however in engineering we use scientific functions i.e Sin , Cos  , ln etc . Within C we have the following functi

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindromes

sample of program that use in bubble sort using assignment operator in c++

B-tree: A B-tree is an also called balanced m-way tree. A node of the tree may have many records or key and pointers to children. It is also called as the balanced sort tree. It s

C o n t r o l S t r u c t u r e s I t i s o f t h r e e t y p e s: 1 .    S e qu e n c e s t r u c t u r e 2 .

Access to the channel/devices is achieved by means of general purpose I/O routines Theses are standard functions described in stdio.h header file namely getc and putc. Getc and put

C language lets us do this in a structure definition by putting: bit length after the variable that is. struct packed_struct { unsigned int f1:1; unsigned int f2:1; unsigned