Write a program using for loops t

Assignment Help C/C++ Programming
Reference no: EM13165802

Write a program using for loops to produce the following output. Please read carefully the entire specification! Your program must work for any odd number entered by the user, not just 13.

Enter an odd number width: 13

 

Hill:

*

***

*****

*******

*********

***********

*************

 

Triangle:

      *

     ***

    *****

   *******

*********

***********

*************

 

Diamond:

     *

    ***

   *****

*******

  *********

***********

*************

***********

  *********

*******

   *****

    ***

     *

 

Start with the Hill. Each line must be printed with a 1 for loop. Figure out how to print a line of stars, printing 1 star at a time. The number of lines is controlled by a for loop around that loop and prints each line

 

To print the Triangle, figure out how to print an upside down Hill, like this

*******

*****

***

*

 

Then, change the star * to a single space! Each line should be printed with more than 1 for loop, which is embedded in anotherfor loop that prints multiple lines (i.e. the top 6 lines). This diagram might help:

 

 

 

 

 

Finally, to print the Diamond, print the Triangle for the top, and then use similar, sort of backward for loops to produce the bottom of the Diamond.

 

 

Reference no: EM13165802

Questions Cloud

The load master for a freighter : The load master for a freighter wants to determine the mix of cargo to be carried on the next trip. The ship's volume limit for cargo is 100,000 cubic meters, and it weight capacity is 2,310 tons.
Storage systems increasingly rely on the internet : Storage systems increasingly rely on the Internet infrastructure as a transport medium. What are the advantages of this approach? What problems are present in terms of security and reliability?
Slugworth candies : Slugworth Candies, LLC, is a candy maker company that employs 450 people. The company is composed of six departments: Executive Staff (20), Human Relations (6), Finance and Accounting (15), Marketing and Sales (15), Factory (150), and Research & D..
We would like to implement the lexical order : We would like to implement the lexical order for lists. For simplicity, we only consider lists of numbers, where , >= have their usual meaning.
Write a program using for loops t : Write a program using for loops to produce the following output. Please read carefully the entire specification!
Gradesaverage, which prompts user : Write a program called GradesAverage, which prompts user for the number of students, reads it from the keyboard, and saves it in an int variable called numStudents. It then prompts user for the grades of each of the students and saves them in an i..
Consider an array of integers : Consider an array of integers as below: int[] a = {5, 2, -4, 3, 0, -5, 7, 11, 6, 13} Complete the method named count(int[] a) in the class Count. The method should return the number of positive numbers in the array
The interest rate per period : The interest rate per period. For example, if your loan's interest is 6.5% per year, and you are paying monthly, this would be 6.5%/12. If you are paying every two weeks, r would be 6.5%/26, because there are 26 two-week periods in a year.
. label the rows that make good power ciphers and explain : a) Make a power table for numbers mod 11. Indicate how the table shows Fermat's theorem, label the primitive roots mod 11. Explain how you can tell they are primitive roots. Label the rows that make good power ciphers and explain

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Compares the number of possible sequences

A c++ program that compares the number of possible sequences of the length L that can be generated uinder the following assumptions. Given an alphabet of size N=9. The program must output a formatted list comparing the number of possible sequences..

  Implementation of sorting technique

Implementation of sorting technique

  Write a program in which the user is prompted

Write a program in which the user is prompted for the number of values that they will be entering. The user then enters that number of integers into an array

  The imperial system of measurements

The Imperial system of measurements uses feet and inches for length, where 1 foot is equal to 12 inches. Write a class named Imperial that will represent distance measurements in feet and inches. Your class should include the following.

  Braces for blocks of code

C-- should have braces for blocks of code, an if statement, while statement, and a double, int, and character. Each statement ends with a semi-colon and you must have a main routine

  Write an application that creates a quiz

Write an application that creates a quiz, which contains at least 5 questions about a hobby, popular music, astronomy, or any other personal interest. Each question can be multiple choice(a,b,c,d should be user accepted response), or true or false(t ..

  Design a phonecall class that holds a phone number

Design a PhoneCall class that holds a phone number to which a call is placed, the length of the call in minutes, and the rate charged per minute. Overload extraction and insertion operators for the class.

  Uml diagram of all the classes

Speaking of converting into the correct object-type, the goal of the factory is to abstract away object creation.

  Write a program code to compute and build a table of reynold

Write a program code to compute and build a table of Reynolds numbers at flow velocities varying from 100 to 1000 ft/sec (at increments of 100)

  We wish to process survey results

Suppose we wish to process survey results that are stored in a file. This exercise requires twoseparate programs. First, create a program that prompts the user for survey responses and outputseach response to a file

  Write a menu-driven program that maintains an address book

Write a menu-driven program that maintains an address book using a linked list. The address book must supports the following operations

  Write a complete c++ program

The main program will read in a parameter value n (read this in main). Then it will call a function read2arrays (details below) to read lists of grades into two arrays, which the main program will call test1 and test2 (or some other names of your ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd