Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <stdio.h>
- using namespace std;
- int choice, width, repeats, shot;
- int main () {
- cout << "Please select what you'd like to generate:\n";
- cout << "1. Triangles\n2. Dicks\n";
- cin >> choice;
- while (choice != 1 && choice != 2) {
- cout << "ERROR PLEASE ENTER A VALID CHOICE\n";
- cin >> choice; }
- if (choice == 1) {
- printf ("Enter a width (anything less than 80 works well)\n");
- scanf("%d",&width);
- while (width > 0) {
- while (width > repeats) {
- printf ("*");
- repeats = repeats + 1;
- }
- printf ("\n");
- width = width - 1;
- repeats = 0;
- }
- cin >> width;
- }
- else if (choice == 2) {
- cout << "Please enter a length\n";
- cin >> width;
- cout << "Please enter a shot length\n";
- cin >> shot;
- cout << "8" <<setfill('=') << setw(width);
- cout << "D" <<setfill('~') << setw(shot) << " ";
- cout<< "\nThank you for using the generator";
- }
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement