I an taking a class in C++. Though I have had many years programming, it is an introductory class because one needs to learn the syntax and rules of the new language.
I am writing a program that stores data in a file, and retrieves data from a file and I need to format that data so it will have a structure. What I have elected to do is ask the user for how many numbers to store in the datafile, and then the code will generate that many "random" numbers, calculate the square root, squared, and cubed values of that these 'random" numbers and store the data in columns.
My questions are:
1) How do I make the retrieval code get the "random" number , its square root, squared, and cubed values when these are all on the same line? Is there a way to use something like:
inFile >> num1;
inFile >> num2; and have this line read the next value over on the same line vs. one line below. BTW inFile is set to ifstream to read from the data file using the preprocessor directive #include<fstream>
Do I need to read the whole line and then parse it, and how would one parse a tab delimited line of text?
2) I know what showpoint does, it forces the display of the decimal point, but can I selectively turn it on and off and how?
Thanks for helping me understand more about C++ and its finer points.