Purchase Solution

C Program With Sequence Structure Only

Not what you're looking for?

Ask Custom Question

As you know, three fundamental control structure are sequence, selection and repetition. Can you write a C program using the sequence structure only? Can you avoid using selection structure? Repetition structure? What would you sacrifice in each case?

Purchase this Solution

Solution Summary

In computer science or programming, three fundamental control structures are sequence, selection and repetition. This is a sample C program using the sequence structure only.

Solution Preview

A sequence structure is a set of program statements that are executed sequentially. A simple program can be written using the sequence structure only, without any sacrifices. For example, the sequence structure is implemented here in the instance function named "doSomething":

.............................................
void doSomething(){
cout << "Hello Viet Namn";
cout << "Hello Iraqn";
cout << "Hello American";
cout << "Hello Worldn";

}//end doSomething function
.............................................

The computer program allows us to have as many actions as we want in a sequence structure because it is built therein. Unless directed otherwise, the computer executes statements one after the other in the order by which they are written--that is, IN SEQUENCE.

* Can you avoid using selection structure?

You may avoid using the selection structure in certain situations, but not all because it is needed to execute one of two or more possible avenues of code. You will sacrifice the type of program you want to create because Selections Statements are needed to choose among alternative course of action. They are powerful tools that allow ...

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic Networking Questions

This quiz consists of some basic networking questions.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.