answersLogoWhite

0


Best Answer

C++ programs are structured with data types and functions, much like C before it. However, unlike C, data types and functions can be combined to create entities that encapsulate a set of data and provide an interface to operate upon that data. These data types are known as classes, from which objects can be instantiated. Classes may also contain static data and methods which are local to the class rather than to a specific instance of the class. Although C++ is a general purpose, object-oriented programming language, it is also backwardly compatible with C and programs can be written using 4 different programming styles: procedural programming, data abstraction, object-oriented programming and generic programming. Most C++ programs are written using a combination of these styles.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

The following is a program with 4 classes and a structure. Constructors and destructors are generated automatically by the compiler so you really only need them if you need more specialised construction. However, a user-defined constructor and destructor have been declared in class A.

You don't give any details on what the program should actually do, so it's up to you to fill in the details. As it stands, this program does nothing useful whatsoever, but it has everything you asked for.

#include<iostream>

class A{

A() {} //constructor

~A() {} // destructor

};

class B : public A {};

class C : protected B{};

class D : private C {};

struct E : public A {};

int main()

{

A a;

B b;

C c;

D d;

E e;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write down a program structure of c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

A program c plus plus on automorphic numbers or not?

how to write a program that counts automorphic number from 1 to 999


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


Write a program in c plus plus to implement macro processor?

Don't write, it is already written, google for 'cpp'.


How do you write program to convert meter to kilometer in c plus plus?

Divide it by 1000.


Do I need to write a program to find a substring in a given string in c plus plus?

No.


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.


Write a program in c plus plus to compute first of non-terminal?

there is no solution of this problem...........that's it..........


How many classes can we write in a single c plus plus program?

Its limited only by available memory.


How do you write a C plus plus program that displays a pyramid of Xes on the screen using a for loop?

printf ("x")


Write a program in C programming language that computes the roots of the quadratic equation ax2 plus bx plus c?

Write your program and if you are having a problem post it here with a description of the problem you are having. What you are asking is for someone to do your homework for you.


How do you display stars in c plus plus using the if else structure and a for loop and you use void main?

It depends on what program you design really


Write a c plus plus program to compute two integers?

int x= 1; int y= 2;