0

I'm new to C++ so prepare yourself for something simple that I've overlooked. I'm doing a homework assignment and I have to create a table of windchills. So basically, the temperature and wind speed have to start at 5 and end at 40 in increments of 7. It sounds complicated so I'll just show you.

float windSpeed, temp;
    cout<<"\t\n";
    for(temp = 5; temp <= 40; temp = temp + 7){
        cout << "\t" << temp;}
    cout<<"\n\n\n";
    for(windSpeed = 5; windSpeed <= 40; windSpeed = windSpeed + 7){
        cout << "\n" << setw(5) << windSpeed << setw(5) << endl;}

This is what I have so far. And it yields this output:

https://drive.google.com/file/d/0ByPjF_TtxVWUSVZWOWJHVDJBS28/view?usp=sharing

(I don't have the rep necessary to post an image directly. First post btw.)

So basically, now I have to fill this chart thing that I've made with data. And I'm not sure what the best way to go about doing that is. Because I'm in the command prompt, if I do a separate cout function, It'll just basically start the whole thing over. I'm sure it would take some kind of recursion command. I should probably mention that the (5,5) spot should be zero, and the (40,40) spot should be 25. It goes in increments of 5.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • See [this](http://stackoverflow.com/a/8829105/4074081) discussion on how to write to console in arbitary position. But note, it would be better to prepare the data first and then write entires row by row if it is not supposed to be interactive since it is often useful to redirect command output to file where position commands will not work. btw for homework I suppose it is expected to be written without specific system functions calls. – dewaffled Oct 27 '14 at 09:48

1 Answers1

0

Check out termsql, it's a tool made for purposes like this one.

Manual: http://tobimensch.github.io/termsql/

Project: https://github.com/tobimensch/termsql

With the -m option you can convert it to other formats that may be easier for you to import.

Or you can save it as sqlite database with the -o option.

user3573558
  • 192
  • 1
  • 1