hello everyone, I have encountered a problem using vectors. In this program I am trying to create a vector that contains degree values ranging from 0 to 90 in steps of 5 degrees. The degree function is used to assign the values to the vector but for an unknown reason the output only displays 0's. Help would be gladly apreciated =)
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
void degree (vector<double> &arg, int length)
{
int degree = 0;
int n = 0;
while (n < length)
{
arg.push_back (degree);
n = n + 1;
degree = degree + 5;
}
}
void printarray (vector<double> arg, int length )
{
int n = 0;
while (n < length)
{
cout << arg.at(n) << " ";
n = n + 1.0;
}