Develop a functional c program that implements a design

Assignment Help Programming Languages
Reference no: EM13677622

Strings

Learning Objectives and Outcomes

Develop a functional C program that implements a design and create a C program that declares and uses strings.

Required Setup and Tools

Standard computer lab with Pelles C and Microsoft Visio installed

Recommended Procedures

Task: Create a program to read and reverse a word.

Create a new project named "ReverseWord" and a new source file named "reverse.c". Create a main() function with the usual header and other supporting code. Add a declaration of a string variable named "word" that can hold at least 29 characters (plus the terminator). Add code to print a prompt and add a call to scanf() that reads a string into the variable word. For a hint on use of the scanf() function to read a string, see pages 451-453 of the textbook. Add another call to printf() that echoes the characters entered back to the output. Build and test the program.

Add a declaration of an int variable named "length." Then add a while loop that begins at the first character element of word and increments length while (word[length]!=0). Add a statement after the loop that prints the length found. Build and test your program, and verify that the proper length of the word is printed. Add a for loop that reverses the word. This can be accomplished as follows:

Start a loop iterator at the value 0.

Terminate the loop when the iterator is equal to (length+1)/2.

Add a char variable named temp.

In the loop, use the following statements to swap the characters in the string:

temp = word[i];
word[i] = word[length-i-1];
word[length-i-1] = temp;

Be sure to print the reversed word after exiting the for loop!

Build and test your program using at least three test cases. One test case should use a single-letter word such as "a". A second test case should use a word with an even number of letters, such as "even". A third test case should use a word with an odd number of letters, such as "odd".

Reference no: EM13677622

Questions Cloud

Determine what must be the tension in wire : Two wires are anchored at both ends. Wire 1 has a mass of 147 gram and a length of 9.2 meter. Determine what must be the tension in Wire 1 if its third harmonic is to equal the first overtone of Wire 2
Explain what would the effect be of non-zero acceleration : One of the conditions for Uniform Circular Motion is that the acceleration be centripetal and directed toward the center of motion. Explain what would the effect be of non-zero acceleration parallel to the tangential velocity
Obtain the magnitude of the force : A 1.20 T magnetic field points northeast. Obtain the magnitude of the force on a +0.55 C charge that is moving 11 m/s toward the north
Obtain the maximum voltage across the capacitor : A charged capacitor with C = 690 uF is connected in series to an inductor that has L = 0.460 H and negligible resistance. obtain the maximum voltage across the capacitor
Develop a functional c program that implements a design : Develop a functional C program that implements a design and create a C program that declares and uses strings.
Find what the magnitude of the tangential acceleration : A flywheel with a radius of 0.260 meter starts from rest and accelerates with a constant angular acceleration of 0.750 rad/s2. Find the magnitude of the tangential acceleration, the radial acceleration, and the resultant acceleration of a point on i..
Determine how many turns must there be in the inductor : In the USA, Line voltage is 120 Volt and is driven at 60 Hertz. (Rating is RMS voltage) you have a computer in your circuit that has an inductance of 5mH. Determine how many turns must there be in the inductor
Obtain how many electrons need to leave each object : Two spherical objects with a mass of 8.99 kilogram each are located at a distance of 3.15 meter apart. Obtain how many electrons need to leave each object thus that the net force between them becomes zero
Create a simple bank account simulation : Create a new project named "Accounts" and a new source file named "accounts.c". Enter the following skeleton program. The main() function has been implemented for you. There are four functions you will need to implement to complete the lab.

Reviews

Write a Review

Programming Languages Questions & Answers

  Create project to compute checking account balance

Create a project to compute your checking account balance. Form: Include radio buttons to indicate the type of transaction: deposit, check, or service charge.

  Write program which demands user to enter ten numbers

Write the program which demands user to enter 10 numbers (using an input box) and prints (using a message box) message ‘negative' if number is less than zero.

  Write statement to assign new value to element of array

Write a single statement that assigns a new value to element of the array indexed by j . This new value should be equal to twice the value stored in the next element of the array.

  Write program to decodes messages using caesar cypher

Write a program which decodes messages. Messages will be encoded using Caesar cypher, with each letter being decoded by replacing it with the previous letter in the alphabet.

  Program to do multiplications using divide-and-conquer

Recall that xy = (xy/2)2 if y is even. Use this to write down the function which calculates xy, suppose that y is a power of 2.

  Write a javascript function to validate a text-field

Write a JavaScript function to validate a text-field on a form that is to hold an email address. Now when writing this JavaScript function bear in mind that you won't be able to fully validate it unless you manage to interrogate the server in whic..

  Program to accept inputs from user beginning temperature

Physicists tell us that lowest possible temperature is absolute zero. Absolute zero is -459.69 degrees Fahrenheit. Accept inputs from user: a beginning temperature, ending temperature, and increment value (all Fahrenheit).

  Program for saving account balance report

Savings account balance report from customer savings account file. Every input savings account record contains account number, balance forward, deposits (sum of all deposits).

  Write grading program to find letter grade from exam score

Write pseudo code based on the analysis. Write a grading program which helps to determine your letter grade based on your exam score.

  Write program to store people-s name-phone numbers in array

Write down the program which has the array of at least ten string objects which hold people's name and phone numbers.

  Write a program that will allow a user to enter in a

write a program that will allow a user to enter in a sentence of up to 100 characters. then take that sentence and

  Write down a program which compute the amounts of money

earl and larry each begin a full-time jobs in january 2013 and plan to retire in january 2061 after working for 48

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