I need help organizing my program. In other words it need to be in a list. Example:

Degree             Sin       cos       tan

when it compiles the output is together:

DegreeSincostan0.000.3045

...you get the idea.

I need it to be organized. Where would i need to but a character for it to list Sine cosine and tangent numbers in order from 0- 360 degrees.

#include<iostream.h>
#include<math.h>

void main()
	{
	double radius, degree;
	cout << "Degrees" << "sin" << "cos" << "tan";
	radius = 0;
	degree = 0;
	while (radius <= 2 * M_PI )
	{
	cout << degree;
	cout << sin(radius) << cos(radius) << tan(radius);
	radius += M_PI / 18;
	degree += 10;
	}//close while
	}//end main

<< moderator edit: added [code][/code] tags >>

I need help organizing my program.

Do you mean you want the output to be nicely formatted? Use some maniuplators.

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main()
{
   double radius = 0, degree = 0;
   cout << setw(7) << "Degrees"
        << setw(20) << "sin"
        << setw(20) << "cos"
        << setw(20) << "tan" << endl;
   while ( radius <= 2 * M_PI )
   {
      cout << setw(7) << degree
           << setw(20) << sin(radius)
           << setw(20) << cos(radius)
           << setw(20) << tan(radius) << endl;
      radius += M_PI / 18;
      degree += 10;
   }
}

/* my output
Degrees                 sin                 cos                 tan
      0                   0                   1                   0
     10            0.173648            0.984808            0.176327
     20             0.34202            0.939693             0.36397
     30                 0.5            0.866025             0.57735
     40            0.642788            0.766044              0.8391
     50            0.766044            0.642788             1.19175
     60            0.866025                 0.5             1.73205
     70            0.939693             0.34202             2.74748
     80            0.984808            0.173648             5.67128
     90                   1         6.12303e-17         1.63318e+16
    100            0.984808           -0.173648            -5.67128
    110            0.939693            -0.34202            -2.74748
    120            0.866025                -0.5            -1.73205
    130            0.766044           -0.642788            -1.19175
    140            0.642788           -0.766044             -0.8391
    150                 0.5           -0.866025            -0.57735
    160             0.34202           -0.939693            -0.36397
    170            0.173648           -0.984808           -0.176327
    180         1.45473e-15                  -1        -1.45473e-15
    190           -0.173648           -0.984808            0.176327
    200            -0.34202           -0.939693             0.36397
    210                -0.5           -0.866025             0.57735
    220           -0.642788           -0.766044              0.8391
    230           -0.766044           -0.642788             1.19175
    240           -0.866025                -0.5             1.73205
    250           -0.939693            -0.34202             2.74748
    260           -0.984808           -0.173648             5.67128
    270                  -1        -2.84823e-15         3.51096e+14
    280           -0.984808            0.173648            -5.67128
    290           -0.939693             0.34202            -2.74748
    300           -0.866025                 0.5            -1.73205
    310           -0.766044            0.642788            -1.19175
    320           -0.642788            0.766044             -0.8391
    330                -0.5            0.866025            -0.57735
    340            -0.34202            0.939693            -0.36397
    350           -0.173648            0.984808           -0.176327
    360        -4.68581e-15                   1        -4.68581e-15
*/
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.