/* C program to print shapes */ #include <stdio.h> #include <stdlib.h> void printSquare(int hi, char sym) { int i, j; printf(" "); for(i = 0; i < hi; i++) { for(j = 0; j < hi; j++) { if(i == 0 || j ==0 || i == hi - 1 || j == hi -1) printf("%c", sym); else printf(" "); } printf(" "); } } void printDiamond(int hi, char sym) { int i, j; int mid = hi/2; printf(" "); for(i = 0; i < hi; i++) { for(j = 0; j < hi; j++) { if(i <= 3 && (mid - i == j) || (mid + i) == j) printf("%c", sym); else if(i > 3 && (i - mid == j) || (hi - i + mid - 1) == j) printf("%c", sym); else printf(" "); } printf(" "); } } int main() { int choice; int hi; char sym; do { printf("Menu "); printf("1. Square "); printf("2. Diamond "); printf("3. Quit "); printf(" Enter Choice: "); scanf("%d", &choice); if(choice == 1) { printf("Enter Height and Symbol: "); scanf("%d %c", &hi, &sym); printSquare(hi, sym); } else if(choice == 2) { printf("Enter Height and Symbol: "); scanf("%d %c", &hi, &sym); printDiamond(hi, sym); } else if(choice == 3) { exit(0); } printf(" "); } while(1); return 0; } /* Main Function with switch int main() { int choice; int hi; char sym; do { printf("Menu "); printf("1. Square "); printf("2. Diamond "); printf("3. Quit "); printf(" Enter Choice: "); scanf("%d", &choice); swicth(choice) { case 1: printf("Enter Height and Symbol: "); scanf("%d %c", &hi, &sym); printSquare(hi, sym); break; case 2: printf("Enter Height and Symbol: "); scanf("%d %c", &hi, &sym); printDiamond(hi, sym); break; case 3: exit(0); } printf(" "); } while(1); return 0; } */
Note: For any query, drop a comment.
Write a C program that does the following: • Displays a menu (similar to what you...
Write a program in Python that will: Here are following requirements to completing Menu shapes: 1. Create a "MENU" with 4 - 5 options have the user click the option and thereafter ask the user to enter the amount of stars from 1 - 50. From there your "for loop" will create the shape. Menu options need to be: 1. Filled Triangle 2. filled Square 3. This can be any shape such as a Square, circle, a different angle of...
Using C++, Write a program that will provide the user a menu from which the user may select to calculate the area of one of four geometric shapes: a circle, a rectangle, a triangle, and a trapezoid. You should use the most appropriate SWITCH block for this program. The user will input all data needed to calculate the area. The program should output all data input by the user, the calculated area, and the geometric shape selected. Run this program...
Write codes that will produce the screen as shown Firstly, the program prompts user to enter his name. Then it will display Hello <user name>. Next it prints out a menu which contains 5 options (1- add two integers, 2- add two strings, 3- compute factorial, 4- reverse a string, 5- quit program). Code all 5 tasks appropriately. When the task is completed (not including quitting program of course), the menu pops up again and asks user to try...
Use Python 3 Create a program that uses Turtle to draw shapes. Show the following menu: Enter Circle Enter Rectangle Remove Shape Draw Shapes Exit Circles – User inputs position, radius, and color. The position is the CENTER of the circle Rectangles – User inputs position, height, width, color. The position is the lower left-hand corner Colors – Allow red, yellow, blue, and green only Remove – Show the number of items in the list and let the user enter...
Menu-driven programs will display the menu options to the user and then prompt them for a menu choice. This program will display the following menu in the following format: Calculator Options: Calculate the area of a circle Calculate the area of a rectangle Calculate the area of a triangle Calculate the area of a trapezoid Calculate the area of a sphere Exit Enter your choice (1-6) Once the user enters a choice for the menu, the program should use a...
Write a Program that has a menu with a layout below, that asks the user if they want to: 1. Converts from feet and inches to meter and centimeters 2. Converts from meter and centimeters to feet and inches 3. Quit the program The program should continue as long as the user asks it to. The program will use a switch statement for the menu option selection. Either a do loo or a do-while loop can be used for the overall...
Create a menu-driven program (using the switch) that finds and displays areas of 3 different objects. The menu should have the following 4 choices: 1 -- rectangle 2 -- circle 3 -- triangle 4 -- quit If the user selects choice 1, the program should find the area of a rectangle. rectangle area = length * width If the user selects choice 2, the program should find the area of a circle. circle area = PI * radius * radius...
IN JAVA: Write a program that displays a menu as shown in the sample run. You can enter 1, 2, 3, or 4 for choosing an addition, subtraction, multiplication, or division test. After a test is finished, the menu is redisplayed. You may choose another test or enter 5 to exit the system. Each test generates two random single-digit numbers to form a question for addition, subtraction, multiplication, or division. For a subtraction such as number1 – number2, number1 is...
Code should be written in C++ 2. [11] You have been hired by Shapes Calculator Menu Maker to create a C++ console application that prompts the user with a menu and various options. Starting from Lab03, prompt the user for a char value that corresponds to one of the following menu options: a. Sphere=4*pi"radius3 (hint: use a constant value for pi=3.1415) b. Right Circular Cylinder- piradius*height c. Rectangular Parallelepiped length *width height d. Cone-*pi*radius2 height 3 x. Exit menu. Implement...
In C++ write a simple menu program that displays a menu for the user in an object-oriented technique. The menu should keep showing up until the user chooses to quit. Also, there is a sub-menu inside a menu. The user should get at least a line displayed after he or she chooses that particular option meaning if the user presses 1 for the read actors from the file. The output can look like "reading actors from a file" and then...