How switch function differs from user defined functions in C?
. please give me 3 or 4 differences.one difference is that user defined can be called anytime but not for switch
There is no such thing as 'switch function'
What c plus plus programming statements to implement data abstraction?
Data abstraction is a design concept, whereby interfaces and implementations are kept separate. That is, it should not be necessary to know how an object works in order to use it. The interface provides all you need to know.
This reflects much of real life. When watching TV, you have a remote control which allows you to select a channel, but it is not necessary to know how the TV receives and processes radio signals, nor how it separates one channel from another. Those are implementation details that are only of concern to TV engineers.
In C++, there are no statements as such to implement data abstraction. You achieve it by designing a public interface which is accessible to normal users, and a private interface that is only accessible to the class designer.
Algorithm of Fibonacci series in c?
#include<stdio.h>
#include<conio.h>
int fib(int a);
main()
{
int a;
clrscr();
scanf("%d",&a);
for(int i=0;i<a;i++)
printf("%d\n",fib(i));
}
int fib(int a)
{
if(a==0)
return 0;
if(a==1)
return 1;
else
return (fib(a-1)+fib(a-2));
}
Code to add 2 integer numbers without using int float and double?
int num1 = 1;
int num2 = 50;
int addition = num1 + num2;
Write a program to display a content of a queue?
This is really dependent how your queue is implemented. Unfortunately, working from the outside of a queue, this is usually impossible without removing all elements from the queue.
while !queue.isEmpty() print queue.dequeue()
How do you write a c program to convert binary to decimal using stack?
ALGORITHM: function outputInBinary(Integer n) Stack s = new Stack while n > 0 do Integer bit = n modulo 2 s.push(bit) if s is fullthen return error end if n = floor(n / 2) end while while s is not empty dooutput(s.pop()) end while end function
Actually, there is not that much attention today paid to object-oriented programming. It is not a new technology. It is more than 15 years old, and the design paradigm of object-oriented design and object-oriented programming is relatively well established.
Where the attention today is focused is more on multi-threaded programming. The reason for this is that today's processors are approaching the point where Moore's Law is starting to flatten out, i.e. we are approaching the limits of performance gains in a single processor as technology advances.
Many modern computers solve this problem by having more than one processor. Some have many, even thousands or more, such as in a modern supercomputer. The problem is that it is very difficult to write algorithm's that can adequately take advantage of that parallelism. We tend to think linearly, and our algorithms follow that thinking. Such a linear process, however, can only use one processor at a time. We need to work on algorithms that can utilize all of the available processors in a computer at the same time.
Two "yesterdays" ago, the challenge was Block Structured Programming. One "yesterday" ago, the challenge was Object Orientation. "Today", the challenge is Multi-Threading.
Write a Flowchart for Fibonacci series?
1.start
2.a=0,b=1,c and counter
3.display a
4.display b
5.c=a+b
6.display c
7.a=b
8.b=c
9.check whether number is less than the last number you have
if yes than go to step 5
if no stop it
How do you make an program in object oriented programming?
Object Oriented Programming is the technique to create programs based on the real world..object oriented programming model programs are organized around objects and data rather than actions and logic. In OOP based language the principal aim is to find out the objects to manipulate and their relation between each other.OOP offers greater flexibility and compatibility and is popular in developing larger application.
What is a structure in c language and what are its uses?
A structure is a collection of data (variables) with some common meaning or semantical link meaningful to the programmer. They don't have any meaning to the PC (though their use influences the flow of your program).
In general, it is easier to simply collect information in a structure - for example, the width and height of an image, or the first/last names and addresses of customers. It's just easier to think that way, because things in life tend to have relations to each other.
The INT function is to convert something into an integer. An integer is a number that goes out two decimal places.
A variable data is anything that won't necessarily be the same every time you run a computer program. It may come from user input, from a random function, from consulting a database, etc.
What is the Difference between features and attributes?
Functionality refers to how well something works.
Features refer to what something can do.
A Feature is a sub-system or facility that in included within a larger system.
A Function is the an action that can be performed within the system. Many Functionalities are enabled through a Feature.
For instance, User Administration is a feature offered in Windows. Add User, Grant Privilege to User, Delete User, List Users, etc. are Functions enabled by the User Administration feature.
What is stream in C plus plus?
It's a bit difficult to show a class hierarchy using unformatted text alone, so I'll use the scope resolution operator to show the relationships instead.
Note: [] denotes multiple inheritance
ios_base
ios_base::ios
ios_base::ios::istream
ios_base::ios::ostream:
ios_base::ios::istream::ifstream
ios_base::ios::ostream::ofstream
ios_base::ios::[istream/ostream]::iostream
ios_base::ios::[istream/ostream]::iostream::fstream
ios_base::ios::[istream/ostream]::iostream::stdiostream
ios_base::ios::[istream/ostream]::iostream::stringstream
streambuf
streambuf::filebuf
streambuf::stdiobuf
Anything that you can't put whitespace between. The indivisible elements of a program.
Example: printf("Sup world %d",variable);
Tokens: (7 total)
printf
(
"Sup World %d"
,
variable
)
;
What is the difference between an assembler and a translator?
what is the difference between an assembler and the translator
What do you call a person who is addicted to computer programming?
One thing that you can call a person that is addicted to computer programming is a computer nerd. A computer nerd is always on the computer.
Compile Time: In longer form, you might say, "at the time of compiling", or, "when the program is compiled".
When you compile a program, the compiler applies various processes to your source code in order to generate the executable files. These are actions that happen "at compile time".
Other actions happen when you actually run the finished program. These actions are said to occur, at, or in, "run time".
#include<stdio.h>
#include<string.h>
void main()
{
char str[50];
char ext[50];
int pos,len,i,j=0;
printf("\nenter the main string.....-\n");
gets(str);
printf("\nenter the position and length of the string to be extracted...-\n");
scanf("%d%d",&pos,&len);
for(i=pos-1;i<len+pos;i++)
{
ext[j++]=str[i];
}
puts(ext);
}
/* this is a much easier solution by : ROHIT VERMA*/
Difference between break and goto in C?
The break statement will immediately jump to the end of the current block of code.
The continue statement will skip the rest of the code in the current loop block and will return to the evaluation part of the loop. In a do or while loop, the condition will be tested and the loop will keep executing or exit as necessary. In a for loop, the counting expression (rightmost part of the for loop declaration) will be evaluated and then the condition will be tested.
Example:
#include main() { int i; int j = 10; for( i = 0; i <= j; i ++ ) { if( i == 5 ) { continue; } printf("Hello %d\n", i ); } } #include main() { int i; int j = 10; for( i = 0; i <= j; i ++ ) { if( i == 5 ) { continue; } printf("Hello %d\n", i ); } } #include main() { int i; int j = 10; for( i = 0; i <= j; i ++ ) { if( i == 5 ) { continue; } printf("Hello %d\n", i ); } }
for(int i = 0; i < 10; i++){
if(i == 0) continue;
DoSomeThingWith(i);
}
will not execute DoSomeThingWith for i = 0, but the loop will continue and DoSomeThingWith will be executed for i = 1 to i = 9.
What drug helps to lose weight the fastest?
Eating a healthy, varied diet that is high in fruits and vegetables — including soluble fiber, vitamin D, and probiotics — is the best plan for losing weight from your waistline. Avoiding refined carbohydrates, sugar, and processed foods whenever possible will help you cut calories and get rid of fat more quickly.reduce
How quickly will you lose weight? The volunteers reduced their waist sizes by an average of 1 inch for every 4lb (1.81kg) they lost. So if you lose 1lb (0.45kg) a week you could hope to your waistline by an inch after four weeks. If you are interested to know the amazing secret tips which helps me lose weight fast then click on the link in my bio
How is the main function called in a 'c' language program?
There is no default argument to the main function in C. Every C program must have one (and only one) main function. The standard dictates that the main function may have either of the following definitions:
int main (void) {/*...*/}
int main (int argc, char** argv) {/*...*/}
The first version is used when your program does not require any command-line switches. Note that int main () is an acceptable declaration of the main function in both C and C++, but is not a valid definition in C. Note also that, in C, the return type may be declared void, but not in C++.
The second version is more common. The argc argument holds the count of all arguments in the argv array and is always at least one. The argv argument refers to an array of char pointers to null-terminated character arrays thus all arguments are strings. Thus the value 42 will be passed as the string "42".
The first element, argv[0], is always the fully-qualified path to the program executable (hence argc is always at least one). As well as allowing your program to determine its physical location upon the system, it allows your program to determine its given name even if the user has renamed your executable. This is useful when printing error messages.
Any additional arguments passed from the command-line will be found in elements argv[1] through argv[argc-1]. The final element, argv[argc], is always nullptr.
Write a program using c plus plus to check whether the given square matrix is symmetric or not?
means whether the matrix is same or not
program for symmetric matrix :
include<stdio.h>
#include<conio.h>
main()
{
int a[10][10],at[10][10],k,i,j,m,n;
clrscr();
printf("enter the order of matrix");
scanf("%d %d",&m,&n);
printf("enter the matrix");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
at[i][j]=a[j][i];
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(at[i][j]!=a[i][j])
k=1;
}
}
if(k==1)
printf("not symmetric");
else
printf("symmetric");
getch();
}
// create an BufferedReader from the standard input stream
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String currentLine = "";
int total = 0;
int[] ints = new int[5];
// read integers
while (total < 5) {
// get input
System.out.print("Input an integer: ");
currentLine = in.readLine();
// parse as integer
try {
int input = Integer.parseInt(currentLine);
ints[total] = input;
++total;
} catch (final NumberFormatException ex) {
System.out.println("That was not an integer.");
}
}
// print each number
for (int i = 0; i < ints.length; ++i) {
// get individual digits
if (ints[i] == 0) {
System.out.println(0);
} else {
while (ints[i] > 0) {
System.out.println(ints[i] % 10);
ints[i] /= 10;
}
}
}
Note that this prints out the digits in reverse order (2048 will print 8 first and 2 last).
What are the applications of array?
arrays are used to store the group of data which are of same type.
These arrays can be applied in student mark sheet applications,online library applications etc.