| School of Physics |
|
| Physics Home | Study here | Our Teaching | Our Research | Our Centres | News | Work here | EMPS |
Back to top
Exercises 5These exercises form part of your assessment. Hint: Test your inputSince input using scanf() is new to you, I strongly recommend that when you read in a number you immediately print it out to the screen as a test that you have read it in properly. (To be honest, I would recommend this anyway, it's a very quick test that can save a lot of time and trouble.) Ideally checks like this should be printed to stderr, not stdout as they are not part of the output that the program is designed to create. File testThis is unassessed and need not be handed in.To test that you can write and read a file, write a short program to write a double to a file, close the file, open the file again for reading and read in the number. Remember to use "%lf" for reading a double. Of course, you should check that you read in the number correctly. Look to see where the program created the output file, it should be inside a folder in your project folder. Exercise: angles and sides of a triangle.
|