Completed

C++ using struct

This project was successfully completed by rhythmist for $30 USD in a day.

Get free quotes for a project like this
Employer working
Completed by:
Skills Required
Project Budget
$30 - $250 USD
Completed In
1 day
Total Bids
9
Project Description

Write a program, [url removed, login to view], that uses a struct called block which has three fields:

1. An integer rows
2. An integer cols
3. An character letter

A block will be declared and initialized in main. The program should repeatedly read one of the following commands until a q is entered:

r: Change the number of rows in the block
c: Change the number of columns in the block
l: Change the letter in the block
a: Change the letter in the block based on an ASCII value
p: Print the block in two dimensional format

If an illegal command is entered, the program should print an appropriate error message.

You are required to write the following six functions:

// initializes the block to 4 rows, 4 columns and the
// letter *
void init_block (block& b);

// prompts for and reads a number of rows from the user
// and assigns that number of rows to the block
void change_rows (block& b);

// prompts for and reads a number of columns from
// the user and assigns that number of columns to the
// block
void change_cols (block& b);


// prompts for and reads the ASCII value of a character
// from the user and sets the letter in the block to
// that character
void change_ascii (block& b);

// prompts for and reads a letter from
// the user and assigns that letter to the
// block
void change_letter (block& b);

// prints the block in two dimensional format with a
// label
void print (block b);

The following page shows a sample run of the program (user input in bold). Your program should use the same output formatting.

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online