Question

AUT COMP500 ENSE501: Week 7 - Exercise: EXERCISE NAME: Draw ASCII Box Write a function named draw ascii box that will produce

in c language pls

0 0
Add a comment Improve this question Transcribed image text
Answer #1


#include <stdio.h>

void draw_ascii_box(char hor,char ver,char cor,int h,int l){
for(int i=0;i<h;i++){
for(int j=0;j<l;j++){
if((i==0 && j==0) || (i==0 && j==l-1) || (j==0 && i==h-1)|| (j==l-1 && i==h-1)){ //for corner
printf("%c",cor);
}
else if(i==0 || i==h-1){ //for horizontal lines
printf("%c",hor);
}
else if(j==0 || j==l-1){ //for verticle line
printf("%c",ver);
}
else{
printf(" "); //space within rect
}
}
printf("\n");
}
  
}
int main()
{
draw_ascii_box('-','|','+',3,5);
draw_ascii_box('o','+','O',4,6);
draw_ascii_box('=','H','#',5,13);

return 0;
}

output

+---+
| |
+---+
OooooO
+ +
+ +
OooooO
#===========#
H H
H H
H H
#===========#


Add a comment
Know the answer?
Add Answer to:
in c language pls AUT COMP500 ENSE501: Week 7 - Exercise: EXERCISE NAME: Draw ASCII Box...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please in c language thank u AUT COMP500/ ENSE501: Week 11- Exercise: EXERCISE NAME: Encrypted ASCII...

    please in c language thank u AUT COMP500/ ENSE501: Week 11- Exercise: EXERCISE NAME: Encrypted ASCII The file encrypted.bin contains an encrypted ASCII image Each byte store in the file needs to have its bit flipped to reveal its secret ASCII code. Read in the binary file, one byte at a time. Flip the bits of each byte, and print out the resulting ASCII value to reveal an image Ensure the program output is exactly as described, and that the...

  • IN C LANGUAGE PLEASE Open in A AUT COMP500/ ENSE501: Week 7 - Exercise: EXERCISE NAME:...

    IN C LANGUAGE PLEASE Open in A AUT COMP500/ ENSE501: Week 7 - Exercise: EXERCISE NAME: Is Vowel Write a function named is_vowel that accepts a char as input, and returns an integer value of 1 if the parameter input is a vowel. Otherwise the function must return a value of 0. In the main function prompt the user for input, then call is_vowel, and pass in an argument based upon user's input. The main function must then output the...

  • Write this program in C language Ensure the program output is exactly as described, and that...

    Write this program in C language Ensure the program output is exactly as described, and that the whitespace of your source code is well formatted. Utilise good naming practices when declaring variables. EXERCISE NAME: Recursive Movie In the history of Jurassic Park movies the following movies were released: Movie's Name: Jurassic Park The Lost World: Jurassic Park Jurassic Park III Jurassic World Year of Release: Rotten Tomatoes: 1993 93% 1997 51% 2001 50% 2015 72% Implement a structure type named...

  • In C please : The tasks in this exam review exercise are structured in levels. You...

    In C please : The tasks in this exam review exercise are structured in levels. You can see the point distribution for the levels at the end. It is strongly recommended that you ensure you have passed all test cases of lower levels before moving up to a higher level. For example, ensure you have completed all Level 0 and 1 tasks before even looking at Level 2 Tasks. MESSAGE ENCODER LEVEL 0: (test cases - 50 points) Start by...

  • C language huffman This exercise will familiarize you with linked lists, which you will need for...

    C language huffman This exercise will familiarize you with linked lists, which you will need for a subsequent programming Getting Started assignment Overview Requirements Getting Started Submit Start by getting the files. Type 264get hw13 and then cd hw13 from bash. Pre-tester You will get the following files: Q&A Updates 1. huffman.h: An empty header file, you have to define your own functions in this homework. 2. huffman.c: An empty c file, you have to define your own functions in...

  • I need help with this exercise. Than you for the help. Language is C++ 2 Enumeration...

    I need help with this exercise. Than you for the help. Language is C++ 2 Enumeration Data Types Reformat is the shell of a program designed to read characters and process them in the following way Lowercase character Uppercase character Digit Blank Newline Any other character Converts to uppercase and writes the character Writes the character Writes the digit Writes a blank Writes newline Does nothing / Program Reformat reads characters from file DataIn and // writes them to DataOut...

  • Write the code in C language. Computer communication networks sometimes have noise on them, which can...

    Write the code in C language. Computer communication networks sometimes have noise on them, which can corrupt data being transmitted. It is the responsibility of the computers communicating to confirm data is transmitted accurately. One method to do this is to calculate a checksum of the data and transmit the checksum along with the data to ensure accuracy. In C, we can compute a checksum simply by summing the integer ASCII codes in the message and finding the remainder of...

  • 1. Write a C++ program called Password that handles encrypting a password. 2. The program must...

    1. Write a C++ program called Password that handles encrypting a password. 2. The program must perform encryption as follows: a. main method i. Ask the user for a password. ii. Sends the password to a boolean function called isValidPassword to check validity. 1. Returns true if password is at least 8 characters long 2. Returns false if it is not at least 8 characters long iii. If isValidPassword functions returns false 1. Print the following error message “The password...

  • This assignment tests your ability to write C programs that handle keyboard input, formatted console output,...

    This assignment tests your ability to write C programs that handle keyboard input, formatted console output, and input/output with text files. The program also requires that you use ctype functions to deal with the logic. In this program, you will input from the user two characters, which should both be letters where the second letter > the first letter. You will then input a file character-by-character and output those letters that fall between the two characters (inclusively) to an output...

  • Using C programming language Question 1 a) through m) Exercise #1: Write a C program that...

    Using C programming language Question 1 a) through m) Exercise #1: Write a C program that contains the following steps (make sure all variables are int). Read carefully each step as they are not only programming steps but also learning topics that explain how functions in C really work. a. Ask the user for a number between 10 and 99. Write an input validation loop to make sure it is within the prescribed range and ask again if not. b....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT