answersLogoWhite

0

📱

C++ Programming

Questions related to the C++ Computer Programming Language. This ranges all the way from K&R C to the most recent ANSI incarnations of C++, including advanced topics such as Object Oriented Design and Programming, Standard Template Library, and Exceptions. C++ has become one of the most popular languages today, and has been used to write all sort of things for nearly all of the modern operating systems and applications." It it a good compromise between speed, advanced power, and complexity.

2,546 Questions

How do you make Decimal fraction in c plus plus?

Use a double or a float data type. While these are suitable for most floating point purposes, there may be times when you need to deal with extremely small or extremely large numbers with a higher degree of accuracy than is possible with the built-in types. In these cases you must either define your own data type or use a third-party data type. For instance, calculating the millionth decimal digit of pi cannot be achieved with the built-in types alone.

What are the easy tips to learn programming language?

Well, whatever you do, you'll have to learn. The easiest way to learn some basics is to use a high level programming language such as, Perl, PHP, Ruby, Python etc.. (very long list).

Object in c and c plus plus?

C is not an object-oriented programming language and therefore has no objects as such. However, the term is often used in a more general sense to mean any instance of an user-defined or primitive variable/constant. In C++, the term is used specifically to mean any instance of a class.

How can you justify the use of constructor and destructor in c plus plus?

Constructors allow class designers to initialise class attributes at the point of instantiation (whenever an object of the class is created). All classes must have at least one constructor other than the copy and move constructors otherwise it would be impossible to instantiate objects of the class. Copy and move constructors are not required but are generated automatically by the compiler unless the class designer explicitly marks them deleted from the class definition. The copy and move constructors allow new instances to be constructed from existing instances. The only difference between the two is that the move constructor transfers ownership of the member attributes, rather than merely copying them. In classes that contain pointers, the compiler-generated copy constructor only copies the pointer (a shallow copy) not what it points at (a deep copy). Thus class designers must provide a copy constructor in order to deep copy any unshared memory resources. Derived class constructors automatically invoke base class constructors, so classes are always constructed from the bottom up. Copy and move constructors automatically invoke their base class copy and move constructors, respectively, however all other constructors automatically invoke their base class default constructors, which may not be the most efficient method of construction. Thus class designers can invoke specific base class constructors through the constructor's own initialisation list (which is also used to initialise member attributes). Constructor bodies do not require any code except in those cases where initialisation is not possible with the initialisation list alone, however this is usually an indication of poor design choices rather than a limitation of the initialisation list. The initialisation list provides the most efficient mechanism for class initialisation.

Every class must have one (and only one) destructor. If one is not provided by the class designer, the compiler generates one for you. However, unless the class contains a pointer to unshared memory, there is no need to define your own. Otherwise you must provide a destructor in order to release the memory. The destructor is the last chance to do so before an object of the class falls from scope. Classes that are intended to act as base classes must provide a virtual destructor (that is, the lowest base class must declared the destructor virtual). This ensures that if an object is destroyed polymorphically (via a pointer to one of its base classes), the most-derived destructor is always invoked first. Destruction of hierarchies is always top down. Note that destructors are not virtual by default for the simple reason that not all classes are intended to act as base classes. The containers provided by the Standard Template Library (STL) are a good example of this as none of the containers have virtual destructors -- so they cannot be used as base classes. Note that if any class method is declared virtual, the destructor must also be declared virtual. However, when inheriting from a base class with a virtual destructor, the class destructor is implicitly virtual (as are all virtual functions inherited from base classes) and does not need to be specified, although its good practice to explicitly include it anyway.

How do you send email from turbo c language?

You know I am also working on the same task and trying to find the solution of this problem.May be possible that in this we have to give all the steps or all the activity that we perform on the real time browsing. But in this also their is a problem that how you will add text compose.Although It's A tough Task but Don't Loose the hope.

What is the advantage of using a sentinel?

Primarily it allows implementation to be shifted from the list to the nodes themselves. Generally this is more efficient because the list's sole responsibility is the sentinel (which is guaranteed to exist so long as the list is in scope) to which it delegates all responsibility with regards the actual nodes. A tail sentinel improves efficiency further by ensuring the head sentinel node never points to NULL.

Head and tail sentinels are most useful in sorted lists. When data is added to the list, the list immediately passes the data to the head node. When the head node receives data it immediately passes it to the next node, and sets its next node to the return value. The data passes from one node to the next until it reaches a node that contains larger data, or it reaches the tail sentinel. Either way, a new node is created such that it points to the current node, and returns the new node to the calling node which updates its next node to point to the new node. All previous nodes remain unchanged by returning themselves to the calling nodes, all the way back to the head.

This is more efficient than using a non-sentinel list. With this implementation, the list itself must traverse the nodes (if any) to locate the insertion point and then update the links between the nodes. This is because if there are no nodes, the list must handle the insertion itself. Therefore it must handle all insertions, nodes or not. in other words, sentinel nodes shift the responsibility for insertion to the nodes themselves. Since traversal is required anyway, it makes sense to reduce the level of indirection and let the nodes sort themselves out, rather than forcing them into order by a class that has no inherent knowledge of the data it is trying to insert. Data sorting is the responsibility of the nodes that contain it, not the list itself.

What is booting in c plus plus?

Booting is the process of starting the computer from a power off condition. It has nothing to do with C++.

How do you write a C plus plus program to find surface area of a sphere?

Assuming you know the radius of the sphere, use the following function to calculate the surface area:

double area_of_sphere(const double& radius) {

return(pi * radius * radius * 4); }

Note: pi (π) is a global constant defined as follows:

const double pi = atan(1)*4;

Calculating pi this way ensures the highest possible precision on the runtime hardware.

The area calculation is based upon the following formula:

4πr2

Is it possible to remove a fault code on a 1992 F150 by cycling the ignition?

if the fault has been fixed, u can remove code by disconnecting battery for 5 minutes then reconnecting battery

if fault has not been fixed, it will keep showing up until it is fixed

Examples of graphical programs in turbo c plus plus?

It depends what you regard Turbo C++ to be. Originally it was a 16-bit IDE for MS-DOS programs and the last official release, Turbo C++ 4.5, was in 1994. In 2006 it was briefly revived, but was really nothing more than a stripped-down version of Borland's flagship IDE, C++Builder. There were no other versions after 2006. Embarcadero bought both Turbo C++ and C++Builder in 2008 but discontinued support for Turbo C++ in 2009.

Since Turbo C++ 4.5 was for 16-bit MS-DOS systems, there will be few graphical programs capable of running on any modern systems. Some enthusiasts still use it to this day and you can download modified versions that will run on modern operating systems such as Windows 7. However, given the fact it requires a 16-bit virtual machine its usefulness is somewhat minimal.

The 2006 version would be a better option, but as it's no longer available any programs written with it will have long since been ported to another implementation such as Embarcadero C++Builder.

What command is used to destroy object in c plus plus?

You use delete object in C++ to delete an object. You can also implicitly delete the object, if it is automatic type, by going out of local scope.

How does a computer understand the password of case sensitive?

Case sensitive passwords are easier to implement than case insensitive, as the program can simply compare each byte of input against each byte of the stored password, and if there are no mismatched bytes, the password matches.

Can you get an std from rubbing your penis againt?

Depends on what u rub it on example toilet seat - yes random wall down the street- maybe depends on how many rub

What is nesting in C programming?

Nesting can be a very handy tool in C++, but should be avoided if possible.

C++ gives us If statements, For loops and many other things. These can be nested. For example:

A nested If statement:

//outer if statement

If( this is true )

{

//nested if statement

if( this is also true )

{

//do something

}

else

{

//do something else

}

}

Difference between loop and array?

A loop usually referred to the program flow control with possible repetition of executing the same codes, an array is an abstraction of fixed size container. 2 different concepts.

How do you connect an ODBC link through C and C Plus Plus?

make sure to include the lib, to your space, or main, or however you are adding in your libs....

define and instantiate an odbc object. use a command such as objectname.connect, wrap it up in a conditional. If you need it to loop for some real time like update needs...thats acceptable.

Is it mandatory to use the construtors in a class in c plus plus?

No.

If you do not provide a default constructor, the compiler will provide a default constructor that simply allocates memory for the class, but it will not initialize the members of the class.

If you do not provide a copy constructor, then the compiler will provide a copy constructor that allocates memory for the class, and then copies the member's data from class to class. This is bad if the class contains pointers, because only the pointer will be copied - the objects to which the pointers point will not be copied - and you could wind up deleting an object and then using it after deletion, with potentially devastating consequences.

So, yes, it is mandatory, from a good practices point of view, and just plain mandatory when the class has pointers, to always provide a default constructor and a copy constructor, along with the appropriate destructor.

What are the friend function implications on information hiding?

Other than that the friend has privileged access to the private members of the class in which it is declared a friend, there are no implications. However, there has to a be a reason for the friend to require that access.

Program plus program?

Programs are not limited to single use. They can and are often used as components for larger more complex programs. The term for these programs are 'libraries'. In the development of good software, reuse is a highly important concept. Writing good code takes a lot of time. It takes many tests and versions to come up with good code that is error free. By using libraries that are already heavily tested and optimized, time can be saved.