Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int cnt = 0;
- int size;
- while(true) {
- cout << "Enter a size or a negative number to stop: ";
- cin >> size;
- if(size<0) {
- cout << "A total of " << cnt << " *s were printed.\n";
- break;
- }
- cnt += size*size;
- for(int i=0; i<size; i++) {
- for(int j=0; j<size; j++) {
- cout << "*";
- }
- cout << "\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement