answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

Write a C plus plus program to convert a given number into years weeks and days?

#include<iostream>

void num_to_years_weeks_days(

unsigned num, unsigned& years,

unsigned& weeks, unsigned& days)

{

years = num / 365;

num -= years * 365;

weeks = num / 7;

num -= weeks * 7;

days = num;

}

int main()

{

unsigned years, weeks, days;

unsigned num = 1000;

num_to_years_weeks_days(num, years, weeks, days);

std::cout << num << " days is " << years << " years, " << weeks << " weeks and " << days << " days\n" << std::endl;

num = 12345;

std::cout << num << " days is " << years << " years, " << weeks << " weeks and " << days << " days\n" << std::endl;

}

Write c program to enter a string it has to display with space?

#include
#include

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::getline;

int main()
{
string myStr = "";
cout << endl << "Enter your line (to finish press #): ";
getline(cin, myStr, '#');

cout << endl << "You have entered: "" << myStr << """
<< endl;

system("PAUSE");
return 0;

}

Where to you use generics in c?

C doesn't have generics, that's C++.

C program to print 1 12 123 1234?

#include <stdio.h>

int main (void) { puts ("1 22 333 4444 55555"); return 0; }

Why it is advantageous to combine Newton Raphson method and Bisection method to find the root of an algebraic equation of single variable?

An improved root finding scheme is to combine the bisection and Newton-Raphson methods. The bisection method guarantees a root (or singularity) and is used to limit the changes in position estimated by the Newton-Raphson method when the linear assumption is poor. However, Newton-Raphson steps are taken in the nearly linear regime to speed convergence.

In other words, if we know that we have a root bracketed between our two bounding points, we first consider the Newton-Raphson step. If that would predict a next point that is outside of our bracketed range, then we do a bisection step instead by choosing the midpoint of the range to be the next point. We then evaluate the function at the next point and, depending on the sign of that evaluation, replace one of the bounding points with the new point. This keeps the root bracketed, while allowing us to benefit from the speed of Newton-Raphson.

What is the full form of ivr?

It's an abbreviation for Interactive Voice Response, sometime refered to as IVRS (Interactive Voice Response System). IVR is like a complex answering machine with more than one pre-recorded announcements and with ability to recognize and respond to DTMF key presses of human voice.

IVR DefinitionFrom the link IVR Definition under Related Links below:

"Interactive voice response, or IVR, is a computerized phone system that enables a person, typically a telephone caller, to make a selection from a voice menu. The selection is made using touchphone keypad entries or voice responses. This interaction allows the individual to communicate with the phone system and thus the computer system.

The phone system plays pre-recorded voice prompts and the person typically presses a number on a telephone keypad to select the option associated with the voice prompt."

Example

A caller dials a telephone number that is answered by an IVR system. The IVR system executes an application which is tied to the number dialed DNIS (Dialed Number Identification Service). As part of the application, prerecorded audio files or dynamically generated Text to Speech (TTS) audio explain the options available to the caller. The caller is given the choice to select options using DTMF tones or spoken words. Speech recognition is normally used to carry out more complex transactions and simplifies the application menu structure.

Write a program to print 'hello' in output?

Ah, the infamous "Hello World" program.

I'm assuming you have a compiler (if not Dev-C++ if a good)

the code is as follows:

#include <iostream>

using namespace std;

int main()

{

cout << "Hello World" << endl;

system("PAUSE");

return 0;

}

What is the limitation of linear queue and how do you overcome using circular queue?

in linear queue when any element is pop out than we do size-1 value changing ie

like in the pile of coin when we take out the last coin then all changes there places so likewise we have to change the position of each element.....

we can overcome by circular one as we have to change the value of the first and last not the values changes in the array....

but circular queue also had limitation that

either u have to use it as size-1 queue or

it will show you full even though it is empty fully....as first==last...

What is the difference between auto int a and int a?

Nothing: 'auto' is usable only in functions, and there it is the default storage class, so you don't have to use it at all.

What are the application of singly linked list?

A singly-linked list is ideally suited to stacks (last in, first out). The list maintains a link with the head node in the list and each node points to the next node in the list (the last node points to NULL). When a new node is added it is added to the head of the list. Since enqueue and dequeue both occur at the head of the list, processing is always in constant time [O(1)].

With slight modification (maintaining a pointer to the tail node as well as the head), singly-linked lists can also be used for queues (first in first out). Processing remains constant time [O(1)].

However, random access and search are both linear [O(n/2) and O(n) respectively]. While the list can be modified to maintain a sorted list, insert and seek times still average [O(n/2)].

When argument are passed by value the function works with the original arguments in the calling program?

When a function is passed by value the calling function makes a copy of the passed argument and works on that copy. And that's the reason that any changes made in the argument value does gets reflected to the caller.

Definition and comments for loop?

The C and C++ for loop is defined as...

for (init-expression; test-expression; loop-expression) loop-statement;

  • The init-expression is executed once.
  • At the top of the loop, test-expression is evaluated. If it is false, control passes to the statement following loop-statement.
  • The loop-statement is executed. It may be one statement, it may be a block of statements, or it may be no statement. If it is no statement, the semi-colon is required.
  • At the bottom of the loop, loop-expression is executed, and then control passes to the test-expression at the top of the loop for another go-around.
  • Each of init-expression, test-expression, and loop-expression may be missing. The semi-colons are required. The formal "forever" loop is for (;;) loop-statement; in which case the only way out is the break statement.
  • Since each of init-expression, test-expression, and loop-expression can have side-effects, sometimes a loop is constructed with no loop-statement, and all processing is done between the parentheses.
  • If test-expression is initially false, loop-expression and loop-statement are never executed. The init-expression is always executed only one time, and test-expression is executed at least one time.
  • At any point during loop-statement, the breakstatement will exit to the statement following loop-statement, and the continue statement will jump to the loop-expression at the bottom of the loop.

What is adapter in programming language?

An adapter is a class that subclasses a commonly used class or interface with reasonable default functions provided. For example, the WindowAdapter provides a quick solution that provides default do-nothing functions for 4 common interfaces that a GUI would use. Typically, a developer only needs one or two functions from WindowEvent, for example, but without an adapter, they are required to implement seven functions (with five or six of them "do-nothing" functions), instead of just using an adapter and providing the one or two function bodies they do need.

What is bit loading or binary digits loading?

Bit loading is a technique used in multicarrier communication system (eg. OFDM) to assign bits efficiently based subchannel quality, whcih means, it allows more bit to be transmitted within higher quality subchannels and less bits within lower quality subchannnels.

Difference between normal dll and com dll?

A dynamic-link library (DLL) is an executable file that acts as a shared library of functions. Dynamic linking provides a way for a process to call a function that is not part of its executable code. The executable code for the function is located in a DLL, which contains one orA dynamic-link library (DLL) is an executable file that acts as a shared library of functions. Dynamic linking provides a way for a process to call a function that is not part of its executable code. The executable code for the function is located in a DLL, which contains one or more functions that are compiled, linked, and stored separately from the processes that use them. DLLs also facilitate the sharing of data and resources. Multiple applications can simultaneously access the contents of a single copy of a DLL in memory

The Component Object Model (COM) is a component software architecture that allows applications and systems to be built from components supplied by different software vendors. COM is the underlying architecture that forms the foundation for higher-level software services, like those provided by OLE. OLE services span various aspects of component software, including compound documents, custom controls, inter-application scripting, data transfer, and other software interactions. more functions that are compiled, linked, and stored separately from the processes that use them. DLLs also facilitate the sharing of data and resources. Multiple applications can simultaneously access the contents of a single copy of a DLL in memory