Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I am having trouble with my ECE Lab 2 problem 4. I already had the code fro problem 3. I'd appreaciate your help The

Hello, I am having trouble with my ECE Lab 2 problem 4.

I already had the code fro problem 3. I'd appreaciate your help

The program requested in the previous problem assumes that a word has exactly seven letters. However, in reality, words in the ABRACADABRA language may have arbitrary length. Thus it would be nice to modify this program so that it can support words of arbitrary length. Moreover, most ABRACADABRA speakers have not taken ECE15 and cannot write C code themselves. Therefore, you are requested to write a C program, called write encoder.c, that creates by itself the abracadbra encoder program for any given word length. Your program should prompt the user for the desired word length, and then output a C code of the abracadbra encoder program for the specified length. To see how one C program can output another C program, consider the following program, called herein write hello.c, that prints to the screen the famous "hello world!" program:

Note that the fourth printf statement above contains the sequences \" and \\. The reason is that inside a printf statement, the characters " and \ have special meanings: the former signifies the start and the end of the printf format string, while the latter modifies the meaning of the character that follows. For example, is the new-line character, rather than the character 'n'. To "turn off" these special meanings, one should precede " and \ by the backslash \. Thus \" just prints a " while \\ just prints a \. You might want to test those yourself. I The % character also has a special meaning inside the printf format string (what is its meaning?). Thus, in order to print the % character itself, you should write %%. For example, check the output of printf("Up to 50%% discount!") I To verify the correctness of the above program you should redirect its output to a file. For example, if the executable file is called write hello, you should invoke the program as follows:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions