All pastes #732730 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-11 06:36 UTC
rendered paste body
#include <iostream>
#include <conio.h>
using namespace std;

struct shape 
{
	int size;
	char character;
} triangle, square;

int main() {
	int choice;
	char inrepeat;
	bool repeat = true;
	int snum1;
	int snum2;
	int tnum1;
	int tnum2;

	cout << "Welcome to the Hall of Simple C++ ASCII Graphics!\n";

	while(1) {
		cout << "Please enter a selection below\n";
		cout << "1. Draw a triangle.\n" << "2. Draw a square.\n" << "3. Quit.\n";
		cin >> choice;

		if(choice==3) {
			break;
		}
		else if(choice < 1 || choice > 3) {
			continue;
		}
		else if(choice==1) {
			cout << "What is the height of the triangle? ";
			cin >> triangle.size;
			cout << endl;
			cout << "What is the character that you want to display for the triangle? ";
			cin >> triangle.character;
			for(tnum1 = 0; tnum1 != triangle.size; tnum1++) {
				cout << triangle.character;
				cout << endl;
			}
		}
		else if(choice==2) {
			cout << "What is the height of the square? ";
			cin >> square.size;
			cout << endl;
			cout << "what is the character that you want to display for the square? ";
			cin >> square.character;
			for(snum1 = 0; snum1 != square.size; snum1++) {
				cout << endl;
				for(snum2 = 0; snum2 != square.size; snum2++) {
					cout << square.character;
				}

			}
				
		}
		cout << endl;
		cout << "Would you like to go again (y,n only)";
		cin >> inrepeat;
		if(inrepeat=='n') {
			repeat = false;
		}
	
		system("cls");
		while(repeat==true);
		return(0);
	}
}