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

What is the difference between initialisation and definition in C programming?

Variable-declaration is:

extern int x;

extern double y;

extern char a;

Variable-definition is:

int x;

static double y;

auto char a;

Variable-definition with initialization is:

int x = 1;

static double y= 2.3;

auto char a = 'w';

Define polymorphism in c plus plus?

Polymorphism is the ability to use an operator or function in different ways. Polymorphism gives different meanings or functions to the operators or functions. Poly, referring to many, signifies the many uses of these operators and functions. A single function usage or an operator functioning in many ways can be called polymorphism. Polymorphism refers to codes, operations or objects that behave differently in different contexts.

How do you convert from assembly to binary in c plus plus?

Use inline assembly instructions. Then compile your C++ program to produce the machine code.

What is cputs function in computer c plus plus?

Nothing.

The C language only recognizes a few keywords, like "for" and "if". Most of what's in a C program ... that doesn't reference routines in the C program itself ... are library calls, and cputs() is one of those. What it does is write its argument (which should be a pointer to a character string) to the console... console put string.

C plus plus program for sum of n numbers using class?

#include <iostream>

int main()

{

double num1 = 0.0;

std::cout << "Enter first number: ";

std::cin >> num1;

double num2 = 0.0;

std::cout << "Enter second number: ";

std::cin >> num2;

std::cout << num1 << " + " << num2 << " = " << (num1 + num2);

return 0;

}

HOW to display array elements C plus plus?

In C++, it is better to use vectors than dynamic arrays because a vector always knows its own size. C-style arrays are better suited to static arrays where the size is always known in advance. The following demonstrates how a vector might be used within a class.

#include<iostream>

#include<vector>

class foo

{

public:

std::vector<int>& operator+= (int data){ m_data.push_back(data); return(m_data);}

int operator[] (size_t element)const{

ASSERT(element<m_array.size());

return( m_array[element]; }

const size_t size()const{return(m_data.size());}

private:

std::vector<int> m_data;

}

int main()

{

foo f;

f += 42;

f += 9;

for(int i=0; i<f.size(); ++i)

std::cout<<f[i]<<std::endl;

}

Output:

42

9

How do you make C plus plus Program Autorun?

This is not a C++ question. It is an operating system question. Different operating systems have different ways of making programs run on startup. Most of them have several different ways to accomplish this. In MS Windows, one way is to place a shortcut for the program in the "{percent}userprofile{percent}\Start Menu\Programs\Startup" shell folder.

What is the difference between C plus plus and MS Visual C plus plus computer programming?

C++ is simply the generic implementation, based upon the version originally developed by Bjarne Storustrup, and which is considered the standard implementation. Visual C++ is Microsoft's implementation of the language, which follows much of the standard, but is not 100% compliant. However, VC++ includes an extensive and exclusive library that is specific to Windows programming. Competitors such as Embarcadero's C++ Builder have similarly extensive Windows libraries but which are not compatible with Microsoft's.

Can you have inline virtual functions in a class?

No, inlining is done at compile time whereas virtual functions are resolved at run time(late binding). So, virtual functions can't be inlined. Both properties are orthogonal.Inlining is a mere suggestion the compiler may ignore it if it is declared with virtual function.

Write the algorithm to find the largest number of three number?

To determine the largest of any group of numbers, we must first determine the largest of any two numbers. For that we use the following simple algorithm:


If number A is greater than number B, then return number A otherwise return number B.


In C++ we can encode this algorithm using the following template function: