Skip to content

Instantly share code, notes, and snippets.

@RSquaredSoftware
Last active December 27, 2015 17:59
Show Gist options
  • Save RSquaredSoftware/7366645 to your computer and use it in GitHub Desktop.
Save RSquaredSoftware/7366645 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
void print_array(double[], int);
int main() {
const int ARRAYLEN = 9;
//Initialized array starting from .1
double numbers[ARRAYLEN];
double num = .1;
for (int i = 0; i < 9; i++){
numbers[i] = num;
num += 1;
}
/* Do part 2 here: */
cout << numbers[ARRAYLEN-1] << endl;
/* Do parts 3 and 4 here: */
print_array(numbers,ARRAYLEN);
/* Do part 5 here: */
for (int i = 0; i < 9; i++){
numbers[i] = 10 * numbers[i];
}
print_array(numbers,ARRAYLEN);
/* Do part 6 here: */
/* Do part 7 here: */
string who = "Charles Babbage";
return 0;
}
void print_array(double data[], int size) {
for(int i=0; i < size; ++i) {
cout << data[i] << " ";
}
cout << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment