All the arguments are character arrays. The address argv[i] points to the character array for the ith argument. The functions atoi and atof convert a character array to an integer and a double, respectively. The system header file stdlib.h defines these functions. Use the man pages to see how to use them.
2. Then modify the code so it looks at only three arguments (counting the command itself) with the second argument, an integer and the third, a double. Do the conversions to numeric types and write the results. Put your modified code in your answer file.
3. In this exercise you are asked to compare two strings. The wavelet.cc code uses strcmp to see if an argument string matches a desired pattern. Here we use the standard library string class. The header string declares the string class. Modify your code and call the new version read_args2.cc. Have your new code take four arguments (counting the command itself), compare the second argument with the string eureka and report the result of the comparison. Put your new modifications in the answer file.
Hint: You'll need to construct a string object from the character array that argv[1] points to. To declare the object a, and set its initial value to the character array argv[1], use the declaration string a(argv[1]);. You can build relational expressions with string objects, using operators such as ==, >, and <. And you can use string constants, such as "eureka" in expressions with string objects.
1. In the file ~p6730/examples/a06/pion there is a table with six values per line. Write an awk command to display only the first three numbers in each line. Put the command in the answer file.
2. Let's call the first three numbers kappa, mpi, and dmpi. Write an awk command to generate a table with three columns, the first being 1/kappa, the second, mpi2 and the third, 2*mpi*dmpi. Put the command in the answer file.
3. Put the awk command in the previous problem into a script file called pion.awk and run the command using awk -f. Copy the command and its output to the answer file.