Created
November 30, 2015 02:32
-
-
Save Ryanb58/a3a763076ebfacafa745 to your computer and use it in GitHub Desktop.
C++ Perfect Square using a vector to hold the results.
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> | |
#include <istream> | |
#include <vector> | |
#include <string> | |
using namespace std; | |
int main() { | |
string input; | |
vector<int> squares(100); | |
for (int i = 0; i < squares.size(); i++) | |
{ | |
squares[i] = i * i; | |
} | |
for (int i = 0; i < squares.size(); i++) | |
{ | |
cout << i << " " << squares[i] << endl; | |
} | |
//Pause before exiting the console. | |
cin >> input; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment