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

Advantages and disadvantages of arrays in java?

Arrays permit efficient (constant time) random access but not efficient insertion and deletion of elements. Consequently, arrays are most appropriate for storing a fixed amount of data which will be accessed in an unpredictable fashion.

Another advantage of arrays that has become very important on modern architectures is that iterating through an array has good locality of reference, and so is much faster than iterating through (say) a linked list of the same size, which tends to jump around in memory. However, an array can also be accessed in a random way, as is done with large hash tables, and in this case this is not a benefit.

Arrays also are among the most compact data structures; storing 100 integers in an array takes only 100 times the space required to store an integer, plus perhaps a few bytes of overhead for the whole array. Any pointer-based data structure, on the other hand, must keep its pointers somewhere, and these occupy additional space. This extra space becomes more significant as the data elements become smaller. For example, an array of ASCII characters takes up one byte per character, while on a 32-bit platform, which has 4-byte pointers, a linked list requires at least five bytes per character. Conversely, for very large elements, the space difference becomes a negligible fraction of the total space.

Because arrays have a fixed size, there are some indexes which refer to invalid elements - for example, the index 17 in an array of size 5. What happens when a program attempts to refer to these varies from language to language and platform to platform.

What is difference between plus plus you and you plus plus?

Both ++you and you++ have the same ending result. The variable you is incremented. The difference is that, if you use the combination in a larger expression, then you++ will have the initial value of you, while ++you has the incremented value of you.

What is computer program in c plus plus?

The C++ standard does not impose any extension rules on source code files. Conventionally, all C++ headers use a .h extension while all C++ source files use a .cpp extension, however you are free to choose your own extensions as you see fit. Some programmers prefer .hpp for C++ headers in order to differentiate them from C headers, however there's no requirement to do so unless you are specifically differentiating C-style headers from C++ headers. Similarly with .c and .cpp extensions with respect to C-style code and C++ code. In the main it's best to stick with the well-established conventions.

What does a - followed by a greater than symbol mean in a c plus plus program?

It is a type of pointer dereference operation. If you have a pointer p to an object that has methods or attributes, you can say (*p).m to refer to the m method of the object, or you can say p->m to do the exact same thing.

What is the difference between classes and structure?

Classes are expanded concepts of structures, and can hold functions along with variables and other information.

What is the difference between C plus plus and the D language?

D essentially evolved from practical usage of C++ and added features found in other languages including C#, Eiffel, Java, Python and Ruby. D has garbage collection, design by contract, unit testing, true modules, first class arrays, associative arrays, dynamic arrays, array slicing, nested functions, inner classes, closures, anonymous functions, compile time function execution, lazy evaluation, a re-engineered template syntax and integrated inline assembler.

What is an ordered list of data structure using c plus plus?

An ordered list of data in any programming language is simply a sorted array or list. In C++ this can either mean a sorted array, vector, list or forward list.

Why use of external variables is discouraged?

External variables, or global variables, are generally frowned upon because any code with access to the variables can alter the variables in unexpected ways. Object oriented programming addresses this problem by allowing programmers to encapsulate those variables into an object (often a singleton object) which provides far greater control over how those variables may be altered.

C plus plus get user input without prompting for it?

To prompt a user in C++ you use cout to output the prompt to the console (e.g., the screen). You then use cin to extract the input from the user. So to get user input without a prompt, simply do not output a prompt before accepting input. However, accepting user input without a prompt would be decidedly un-user-friendly, unless you can guarantee the input does not come from the keyboard.

If you're not using the console and the program is actually running in an event-driven interface (such as Windows), then you need only trap the keyboard, mouse or other HID messages that are posted to your application via the application's message loop, and act accordingly.

What is the use and importance of theater for development?

TO USE THEATRE AS TOOL OF DEVELOPMENT LIKE AS EDUCATION AWARENESS FOR OVERALL DEVELOPMENT OF MANKIND....Shahriar KHAN

Difference between standard and user defined identifier?

A standard identifier is a reserved word. Keywords such as for, if, goto, return, continue, break, do, while, final, extern, static and so on are all reserved. Fundamental data types and modifiers such as void, int, char, wchar_t, double, float, long, short, signed, unsigned, const, mutable, constexpr and so on are also reserved. A user-defined identifier is any name (function, class, namespace or alias) that is not a reserved word.

What are the four integral types in C plus plus?

There are far more than 4 integral types in C++. As of C++11, there were 27 integral types:

bool

char

signed char

unsigned char

wchar_t

char16_t

char32_t

short

signed short

unsigned short

short int

signed short int

unsigned short int

int

signed int

unsigned int

long

signed long

unsigned long

long int

signed long int

unsigned long int

long long

signed long long

unsigned long long

long long int

signed long long int

unsigned long long int

What is the difference between a iron free garment and a wrinkle free?

Not much. A wrinkle-resistant garment is designed to minimize wrinkles so that you do not have to iron it much. Some people don't iron the garment at all. I've never seen a garment, other than one made of polyester, which did not require some ironing. I don't know of a manufacturer which markets clothes as iron-free or wrinkle-free.

C plus plus Error Too many arguments in function call?

The function prototype (declaration) determines the number and type of arguments a function will accept. If the number or type of arguments passed to a function do not agree with its prototype, the compiler will notify you of the error.

That is, if the function only accepts one parameter, you cannot call the function by passing two or more arguments, since no such prototype exists. The compiler makes a best guess on which function you were trying to call (by the name you provided) and notifies you that the number or type of arguments do not agree with the available prototypes.

If the function is your own function, you can include the additional parameters as default values and re-implement the function to make use of those parameters, or you can overload the function to provide a completely new implementation that accepts the additional parameters. The new implementation may call the original implementation and embellish that implementation with its own implementation, or it can provide a completely separate implementation.

Note that no two functions can have the same name and signature within the same namespace. Every prototype must be unique and cannot differ by return type alone. That is, the number and/or type of arguments must differ in some way, with no ambiguity, so the compiler knows which function you are actually calling (as determined by the prototype).

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.

How do you write in c plus plus a series of n integers alternating plus and minus?

An array or vector of int or double or any other signed type can achieve this. If the array must alternate, then simply traverse the array alternating the signs as you go:

std::vector<int> v = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

bool sign=true; // true is positive.

for (int i=0; i<9; ++i)

{

if (sign) { // value must be positive

if (v[i]<0) v[i] *= -1; // if negative, make positive

} else { // value must be negative

if (0<v[i]) v[i] *= -1; // if positive, make negative

}

sign = !sign; // switch sign for next iteration

}

C plus plus problems and solutions pdf?

Every quetion is slackness of mind which we intend to correct by opinions and inferences.

It has been said that C plus plus sits at the center of the modern programming universe Explain this statement?

It means that the vast majority of programs are written in C++, because of its high performance (comparable to that of low-level assembler) and low maintenance (comparable to that of high-level Java). Although C++ is a high level language itself, it borrows much from C which is a mid-level language, whereby the source code instructions map closely to the resultant machine code, and therefore has a much reduced level of abstraction. However, C++ also allows object-oriented programming, which allows more highly complex, scalable structures to be modelled much more easily than with C alone.

What is the order of initialization of data in C plus plus?

The general order of initialization is:

  1. Base class objects (if present)
  2. Member data objects
  3. Constructor function code

In C programming language what are the so called functions statement statement block function block and expressions?

Statements are composed from expressions. A semi-colon turns an expression into a statement.

A function is not a statement it is a type definition.

A statement block is a compound statement, one or more statements delimited by braces, {}.

A function block is the body of a function. The body must be enclosed in braces, {}.

What is the strength of c plus plus?

Ease of use (after the learning curve, of course), performance and efficient use of memory.