Last active
December 27, 2015 17:59
-
-
Save RSquaredSoftware/7366645 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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