answersLogoWhite

0


Best Answer

There is no single structure to a C++ program. C++ is multi-paradigm and allows programmers to use any combination of C-style programming, object-oriented programming and template metaprogramming using a mixture of primitive built-in types, standard library types and user-defined types.

User Avatar

Wiki User

βˆ™ 8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 11y ago

Structured programming is best explained by understanding procedural programming first. Procedural programming makes prevalent use of goto statements and makes no use of function calls. In other words, the entire program is written as a single main function, that executes from top to bottom. When a goto is encountered, execution jumps to the appropriate label and continues from there. Thus the execution path is difficult to follow, resulting in "spaghetti code" that is difficult to read and maintain.

Structured programming addresses this problem through the use of procedure calls that allow code to be broken down into small procedures or subroutines that can be called as and when required. Unlike a goto, a procedure call returns to the point of the call and can return values to the caller. Structured programming also makes use of structured loops, such as while, do-while and for, as well as more complex structures such as switch statements. These structures make programs much easier to read and maintain. Both C and C++ allow any combination of procedural and structured programming, while C++ also allows object-oriented programming, which improves structured programming through the use of self-contained objects that encapsulate data and the methods that operate upon that data, thus limiting the scope of the data and ensuring more robust code.

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 12y ago

Programs in C are structured as one or more functions, with main() being a required function (the entry point of the application, which must return an integer). Functions may call other functions. All functions apart from main() must be declared before they are called, either by including the appropriate header file, or by explicitly declaring the function prototype prior to use. The declaration may include the definition, however declarations and definitions are usually separated. C also permits user-defined types, including structures, all of which have public access unless defined locally within a function or statement block. Structures can also contain functions, thus C is considered a structured programming language, although it is primarily a procedural language.

C++ is derived from C but extends the language to provide object-oriented programming concepts (OOP). The syntax is largely the same, with minor differences to cater for OOP compliance. C++ permits procedural and structured programming concepts to be mixed with OOP concepts. Classes in C++ are much like structures, but are private by default. This allows data and the methods that act upon that data to be encapsulated such that data is hidden by a controlling interface, parts of which may be declared publicly accessible. Through inheritance and polymorphism, new classes can be derived from existing classes, minimising code duplication. The same is also true of structures, but without the safeguards that classes provide.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the program structure of C language and C plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the general structure of a C plus plus Language?

The central feature of any C++ program is classes which can be used to express ideas directly in code.


Can you rewrite a cuda file in c c plus plus language?

Yes, you can rewrite a cuda program originally written in c in c plus plus.


What has the author Jeri R Hanly written?

Jeri R. Hanly has written: 'Essential C[plus plus]for engineers and scientists' -- subject(s): C (Computer program language) 'Essential C++ for engineers and scientists' -- subject(s): C++ (Computer program language), C (computer program language)


What has the author Eric P Bloom written?

Eric P. Bloom has written: 'The Turbo C++ trilogy' -- subject(s): C (Computer program language), C++ (Computer program language), Turbo C (Computer file), Turbo C++ 'Turbo C Plus Plus Trilogy' 'The C trilogy' -- subject(s): C (Computer program language)


How do you write an Algorithm for a C plus plus Program?

You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.


Is C plus plus an application program?

No. C++ is a computer language. The development system supporting it is a compiler, linker, editor, debugger, etc.No it is a programming language.


Writing a program in a language such as c plus plus or java is known as what?

Object Oreinted Programming


What has the author Anthony Porter written?

Anthony Porter has written: 'The best C/C++ tips ever' -- subject(s): C++ (Computer program language), C (Computer program language) 'C++ Programming for Windows' 'C[plus plus] programming for Windows' -- subject(s): C


What has the author Stephen C Dewhurst written?

Stephen C. Dewhurst has written: 'Programming in C[plus plus]' -- subject(s): C++ (Computer program language), C 'C++ common knowledge' -- subject(s): C++ (Computer program language) 'Programmer en C++' -- subject(s): C (Langage de programmation)


What the difference between c and c plus plus?

The fundamental difference is that in C++ object-oriented programming (OOP) was added. C is a procedural language (that means. top-down structure design), where as C++, which is an extension of C itself, is an object oriented language.


What has the author Joseph Bergin written?

Joseph. Bergin has written: 'Data structure programming' -- subject(s): C (Computer program language), C++ (Computer program language), Data structures (Computer science), Standard template library 'Data abstraction' -- subject(s): Object-oriented programming (Computer science), C++ (Computer program language), C (Computer program language)


Different parts of c language program?

what are the parts of C language program