Main deffrent between c and cpp?
The main difference between c and c++ is the concept of 'Object Oriented Programming' (OOPS).
Thus c does not have the benefits of oops like:
1. abstraction
2. encapsulation
3. inheritance
4. polymorphism etc.
What is the difference between traversal and search?
Traversal simply means moving from one node to the next. Generally one searches by traversing the list, comparing each node's data with a given datum, either to return a pointer to a single matching node, or to return a list of matching nodes (copied from the list being searched), or simply to collect data about the matching nodes (such as a count of all the matching nodes).
Write a program using while loop?
//program to find the factorial value f any number using while loop
#include<stdio.h>
void main()
{
int i,n,fact=1;
printf("Enter the number\n");
scanf("%d",&n);
i=n;
while (i>=1)
{
fact=fact*i;
i--;
}
printf("The factorial value=%d",fact);
}
the above is a program for calculating tha factorial value of any number which is entered by the user
What are the advantages of the new operator?
The new operator in C++ works in a similar manner to malloc in C, allocating memory from the heap (the free store). However, unlike malloc which returns a void* pointer to uninitialised memory, the new operator returns a pointer of the given type and invokes the appropriate constructor for that type. Moreover, every class of object can overload its new operator to allow construction within memory that has been allocated in advance. That memory is typically allocated through a resource handle (known as an allocator), however we can also override the global new operator if we need to provide our own memory management.
We can still use malloc in C++, however it has no advantages over the new operator and is best avoided in the interests of consistency and, more importantly, type safety. In practice we rarely use the new operator unless we are actually designing our own resource handles or low-level memory allocators. The standard library already provides highly efficient resource handles for the vast majority of our everyday needs, so it is rarely necessary to design our own. Nevertheless, the facility exists for those (very) rare occasions where we really do require "raw" memory.
What is parameters in C plus plus?
Parameters are the formal arguments of a function, as defined by the function. When you pass arguments to a function, those arguments are assigned to the function's parameters, either by value or by reference, depending on how the parameters are declared in the function. The following example explains both:
void foo( int param )
{
// param is a by value parameter, which is a copy of the argument passed to it.
}
void bar( int& param )
{
// param is a reference parameter, which references the argument passed to it.
}
int main()
{
int arg = 100;
foo( arg );
bar( arg );
return( 0 );
}
Note that passing a pointer is the same as passing an int by value: the pointer's value is passed to the function, not the pointer itself. To pass a pointer by reference, you must pass a pointer to pointer and the function's parameter must accept a pointer to pointer.
WAP in c plus plus to implement linked list?
#include<iostream>
#include<list>
int main()
{
// the linked list (of integers)
std::list<int> List;
// insertions:
List.push_back (42);
List.push_back (99);
List.push_back (60);
List.push_front (55);
// point to first node
std::list<int>::iterator n = List.begin();
// advance to next node
++n;
// insert in front of node n
list.insert (n, 33);
// print list:
for (auto node : List) std::cout << node << std::endl;
}
What is mean by resident monitor?
A Resident monitor (1950s-1970s) was a piece of software that was an integral part of a general-use punch card computer.
additional ;
Its main function is to control transferring of Computer from one job to another job
How can you input data and files into the computer?
When audio signals (music, speech, etc) are detected by your computer's microphone, an analog (or continuous) electrical signal is generated. Computers work with digital data, so...there is a device in most computers called an analog-to-digital converter. This chip (or part of a chip) has the ability to sample the analog signal, calculate its amplitude, and return the value to a program (which the displays it, stores it on disk, mixes it, or does a multitude of other things).
This hardware capability is usually built-in to a computer or is a part of a sound card (like a SoundBlaster, etc), while the program is usually something like a Windows' Sound Recorder, audacity, etc.
Difference between connection - oriented and connectionless services?
Two distinct techniques are used in data communications to transfer data. Each has its own advantages and disadvantages. They are the connection-oriented method and the connectionless method:
What is the effect of the message cout?
the effect of the message cout is to indicated that person whom you sending a message to what you trying to say for him to understand and clear but in other term the message cout doesn't affect the other person
'write a simple program for stack operation in c plus plus?
void push(int y) { if(top>stackSize) { cout<<"stack full"<<endl; return; } else { top++; stack[top]=y; } } int pop() { int a; if(top<=0) { cout<<"stack is empty"<<endl; return 0; } else { a=stack[top]; top--; } return(a); }
'how to write a counter program to count from 50 to 300 using while reception?
I'm going to assume you mean a while loop
using namespace std;
#include<iostream>
int main()
{
int ct = 50;
while(ct <= 300)
{
cout<<ct<<endl;
ct++;
}
return 0;
}
What is a compiler in c program?
The compiler is software that allows any high-level language to be translated into the machine language, compilers are language specific, i.e. C language has its own compiler which will translate the code written in C language to the machine language, compiler for Java will do the same task for the Java code
Can you give an example of a transparent object?
If something is transperent it means that u can see through it, and light can be able to pass through it. If a speach is transparent; it means it was made clearly and so easy for people to understand.
Hotter than fire
Higher than Heaven
We're the Class of "2011"
2011..So nice, we're number 1 twice!
Why can't a c plus plus class be derived from a Java class?
I don't see why it couldn't be.
Unless the Java class uses techniques or methods which are available to Java but not C++, then there is no reason that a C++ class couldn't be based on a Java class.
How write a program that display today temperatures and their average in c plus plus?
#include<iostream>
double celsius(double fahrenheit) { return((fahrenheit-32)*5/9); }
double fahrenheit(double celsius) { return(celsius*9/5+32); }
int main()
{
double f, c;
c = celsius( 32.0); // c 212.0
return(0);
}
What is difference between scanf and cin?
scanf is a function (available in C and C++)
cin is an istream object (C++ only)
Advice: when in doubt, use fgets+sscanf
What is c plus plus and where is it used?
C++ is a multi-purpose, cross-platform computer programming language that is used the world over to create everything from console games software to weather prediction software and everything in between.
How an unsigned int can be twice as large as the singed int?
If you have a 1 byte (8 bit) number, then you can use those bits in two different ways, signed and unsigned.
Unsigned means that all 8 bits represent a power of two, so you can go from 00000000 = 0 (2^0) to 11111111 = 255 (2^8 - 1).
SIgned means that you take the first bit and use it to represent positive or negative. In this case 00000001 = 1 and 10000001 = -1. So your range of values is 11111111 = -127 (-(2^7 - 1)) to 01111111 = 127.
There are a couple of problems with this simplified example, one being that you have two different representations for zero. Most computer systems use two's complement to get around this.
What is the advantages of virtual base class?
Virtual classes are useful when you have a derived class that has two base classes which are themselves derived from a common base class. That is, if class A is derived from classes B and C, and classes B and C are both derived from class D, then class A would inherit two instances of class D (one from B, the other from C). This introduces an ambiguity when referring directly to D from A, because there is no way to determine which instance of D you are referring to. By declaring class D to be a virtual base class of both B and C, they will both share the same instance of D, virtually, thus eliminating the ambiguity.
C program for swap two numbers without using temporary variables?
Using a temporary variable:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,temp;
clrscr():
printf("Enter the first number a\n");
scanf("%d",&a);
printf("Enter the second number b\n");
scanf("%d",&b);
printf("Before swapping a=%d b=%d",a,b);
temp=a;
a=b;
b=temp;
printf("The swapped values are: a=%d b=%d",a,b);
getch();
}
Without using a temporary variable:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter the first number a\n");
scanf("%d",&a);
printf("Enter the second number b\n");
scanf("%d",&b);
printf("Before swapping a=%d b=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("The swapped values are: a=%d b=%d\n");
getch();
}