This simply writes pairs of data on the same line. I'd like pairs of data on individual lines. This means I need to insert a line feed, somehow, perhaps via a character insertion. Could someone please tell me how to do this easily?
Finally, my memory is very vague on C programming. Is the proper means to exit a loop an if then statement containing the term "break"? How would that be implemented?
Thank you!
Last edited by Protocol; January 24th, 2013 at 12:54 PM.
Re: Two Questions - Return at end of paired data points in CSV file, and how to "brea
Code tags are done like this:
[code]
Your code goes here
[/code]
This simply writes pairs of data on the same line. I'd like pairs of data on individual lines. This means I need to insert a line feed, somehow, perhaps via a character insertion.
Code:
fprintf(f, "%d,%f\n", Universe.year, Universe.R);
Is the proper means to exit a loop an if then statement containing the term "break"?
There isn't just one way to exit a loop.
Code:
bool someCondition = true;
for (int i = 0; i < someValue && someCondition; ++i)
{
if ( I_want_to_exit_early)
{
someCondition = false;
continue;
}
}
or
Code:
for (int i = 0; i < someValue; ++i)
{
// if the loop needs to terminate prematurely
if ( I_want_to_exit_early )
break;
//...
}
Bookmarks