/* hf01.c * author: racze * creation date: 2011-09-05 * * last modified: 2011-09-05 * by: racze * * rewrote by: BLaci * 2011-09-11 */ #include "hf01/CommandLineParsing.h" #include /* argc: the number of strings after the command prompt * argv: the string array containing those * (--> argv[0] contains the name of the program.) */ int main(int argc, char* argv[]){ /***********************************************************************/ /* The program parameters which can be set at command line, with default values*/ unsigned int aflag = 0; unsigned int bflag = 0; char cvalue[100] = "alma"; unsigned long dvalue = 0; double evalue = 0.0; /*Command line parsing*/ int result = CmdLineParser(argc, argv, &aflag, &bflag, cvalue, &dvalue, &evalue); if(result < 1) return -result; /***********************************************************************/ /* The actual program using the previous parameters * Only evalue is used here */ char line[2000]; // temporary storage for 1 line of input double datax, datay; // data // to be transformed: // (x,y) -> (x,y^evalue) // read the first line from the input: fgets(line, 2000, stdin); // process until the end of the input file: while (!feof(stdin)) { if ( sscanf(line, "%lf %lf", &datax, &datay) == 2 ) { fprintf(stdout, "%lf %lf\n", datax, pow(datay, evalue)); } // read the next line from the input: fgets(line, 2000, stdin); } return 0; }