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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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