First, Please always use code tags - edit your post, select all the code, press the <> button on the right under the format menu. So it looks like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
using namespace std;
i#include <cstdlib>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <algorithm>
#include <sstream>
#include <time.h>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
string wSpd[]={"W","I","N","D"," ","S","P","E","E","D"};
int windSpeed = 5;
int windSpeedA = 5;
int Temp = 5;
int tempCount = -1;
int wSpdCount = 0;
double windChill;
|
You only calculate Wind Chill once, then repeatedly print it out.
This is a lot of code for what it does - probably could do the whole thing in 10 lines. Consider this psuedo code :
1 2 3
|
// nested for loops that increments temp & wind speed
// calc the wind chill using a function call
// print the answer
|
I think it would be a good idea for you to write psuedo code with comments, then go back and write the C++ code after the comments. It is an iterative process - start of with general ideas, then go back & fill in more detail. When ready, write the C++ code. This is a good way of organising your thoughts.
So some other things to help you out :
Why so many
#includes
? Only put them in if you need them.
string WindSpeed = "WINDSPEED"; // I name gave the variable a better name
And what are you trying to do with it here?
1 2 3
|
while(wSpdCount<10)
{
cout<<wSpd[wSpdCount]<<setw(5)<<windSpeedA;
|
This code :
1 2 3 4 5 6
|
while(tempCount<=7)
{
if(tempCount<0)
{
cout<<" ";
}
|
prints 1 space - why are you deliberately being obscure?
This :
Temp=Temp+5;
can be written like this :
Temp += 5;
Some other ideas :
Consider using arrays to store the info into.
Hope all goes well.