1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h>
int main(int argc, const char *argv[]) {
for( int i = 0; i < 5; i++ ) {
for( int j = 0; j < 7; j++ ) {
printf( "ABC" ); // will result in a while loop that exec's 4 times
printf( "XYZ" ); // will result in a while loop that exec's 4 times
}
}
// How many times does "something" happen --- does *anything* happen?
//
// Don't worry about how many machine language instructions "something"
// takes because the goal is to measure how performant the code is,
// *independent* of the computer it is running on.
//
// If the two printf(…) statements take c instructions, and your computer
// can execute c instructions per second, then ultimately, you can derive
// a value 'd' for the time --- but we don't care what d is.
return EXIT_SUCCESS;
}
|
© Copyright 2016 Alexander J. Quinn This content is protected and may not be shared, uploaded, or distributed.