// file: lecture_21/myprog.cc // // revision history: // 20180724 (JP): initial version // // usage: // myprog.exe // // compilation: // g++ -o myprog.exe myprog.cc myfuncts_00.cc myfuncts_01.cc // // expected output: // nedc_000_[1]: myprog.exe // program name: myprog.exe // sum of 27 and 27.272699 is 54.272697 // // This is a simple C program where the code exists in multiple files. // This version was designed to demonstrate how to browse files in the // the Amazon AWS IDE. // // local include files // #include "myprog.h" // main: myprog // // This is a driver program that does some very simple things. // int main(int argc, const char** argv) { // declare a variable for status // int status = (int)0; // call the first function // float value_alex = (float)1.0; fprintf(stdout, "before: value_alex = %f\n", value_alex); fprintf(stdout, "return value = %f\n", set_value(&value_alex)); fprintf(stdout, "after: value_alex = %f\n", value_alex); // demonstrate variable scope // for(long jordan = 0; jordan < 99; jordan++) { long sum = 99; fprintf(stdout, "jordan = %ld\n", jordan); } // with great power comes great responsibility // /* char* buf = (char*)NULL; fprintf(stdout, "before: buf = %u\n", buf); mymemory(buf); fprintf(stdout, "after: buf = %u\n", buf); */ // call a recursive function // fprintf(stdout, "the factorial of %d = %d\n", 4, fact(4.7)); // exit gracefully // return(status); }