Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h" // DO NOT PLACE ANY INCLUDES ABOVE HERE
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <iomanip>
- using namespace std;
- int getValue(string Prompt, int max);
- int main()
- {
- int max = 3;
- int startb;
- int startc;
- string Prow = "Enter row: ";
- string Pcol = "Enter col: ";
- int row = getValue(Prow, max);
- int col = getValue(Pcol, max);
- cout << "\n";
- for (startb = 0; startb<max; startb++) {
- for (startc = 0; startc < max; startc++) {
- cout << "*";
- }
- cout << "\n";
- }
- system("PAUSE");
- return 0;
- }
- int getValue(string Prompt, int max) {
- int value;
- cout << Prompt;
- cin >> value;
- if (value > max || value < 1) {
- while (value > max || value < 1) {
- cout << "Invalid - Enter Again: ";
- cin >> value;
- }
- }
- return value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement