What converts the String sSpoken Tutorial into upper case?
To convert the string sSpoken Tutorial into uppercase in most programming languages, you can use a built-in function or method. For example, in Python, you would use sSpoken_Tutorial.upper(), while in Java, you would use sSpoken_Tutorial.toUpperCase(). Both of these methods will transform all lowercase letters in the string to uppercase.
the distance from A to B is 24Km
How do you write c program using command line arguments for adding two numbers?
#include<stdio.h>
#include<process.h>
#include<stdlib.h>
void main(int argc, char *argv[])
{
int i,result=0;
if(argc<3)
{
puts("Enter atleast two numbers!!");
exit(1);
}
else
{
for(i=0;i<argc;i++)
result+=atoi(argv[i]);
}
printf("Result is %d",result);
}
How do you implement stack using singly linked list?
struct node
{
int info;
struct node *link;
} *top=NULL;
int main()
{
int choice;
while(1)
{ printf("1.Push\n");
printf("2.Pop\n");
printf("3.Display\n");
printf("4.Quit\n");
printf("Enter your choice : ") ;
scanf("%d", &choice);
switch(choice)
{
case 1:
push();
break;
case 2:
pop();
break;
case 3:
display();
break;
case 4:
exit(1);
default :
printf("Wrong choice\n");
}/*End of switch */
}/*End of while */
return 0;
}/*End of main() */
void push()
{
struct node *tmp;
int pushed_item;
tmp = malloc(sizeof(struct node));
printf("Input the new value to be pushed on the stack : ");
scanf("%d",&pushed_item);
tmp->info=pushed_item;
tmp->link=top;
top=tmp;
}/*End of push()*/
void pop()
{
struct node *tmp;
if(top == NULL)
printf("Stack is empty\n");
else
{ tmp=top;
printf("Popped item is %d\n",tmp->info);
top=top->link;
free(tmp);
}
}/*End of pop()*/
void display()
{ struct node *ptr;
ptr=top;
if(top==NULL)
printf("Stack is empty\n");
else
{
printf("Stack elements :\n");
while(ptr!= NULL)
{
printf("%d\n",ptr->info);
ptr = ptr->link;
}/*End of while */
}/*End of else*/
}/*End of display()*/
What is the purpose of the program stack?
Its main use is to store local variables, arguments and return address each time a function is called.
When your program calls a function the following happen :
- The function arguments are put on the stack
- The current instruction pointer is put on the stack
- The program jumps to the start of the function
- Space is allocated on the stack to hold local variables
- The function executes
- The space holding local variables is de-allocated
- The instruction pointer is restored and removed from the stack (we are now leaving the function and resuming the calling procedure)
- The arguments are removed from the stack
Write a program to accept 2 numbers m and n and to display all numbers between m and n?
#include
using std::cin;
using std::cout;
using std::endl;
int main()
{
int numberM = 0;
cout << endl << "Enter m: ";
cin >> numberM;
int numberN = 0;
cout << endl << "Enter n: ";
cin >> numberN;
for (int i = (numberM + 1); i < numberN; i++)
{
cout << endl << i;
}
cout << endl;
system("PAUSE");
return 0;
}
How you get the size of arrays from user?
in c simply add three lines in the begining of your program:
int x;
printf("enter the size of the array to be entered :");
scanf("%d",&x);
after that use x as your maximum limit of array in your program.
in c++ just replace above printf & scanf statements by
cout<<"enter the size of the array to be entered :";
&
cin>>x;
respectively and do not use brackets.
How do we write c program without using swap to interchange values by accessing another variable?
int a,b;
a=a+b;
b=a-b;
a=a-b;
that's it simple
How do you capture the output of C program in to another C program?
HI
You can first include the 1st program in ur 2nd program using # include<..> and then whatever be the output from frst it can be used in second program.
pankaj
That's what popen is good for. Read the manual.It returns the value to the operating system or whatever process launched it. If you launched your program from a batch file then the batch file can detect this return value. If your program is spawned or launched by another program then the return value goes to that parent prgoram or process.
One more thing is that you can write main() without the return type and it will be absolutely correct
What is double precision value?
That usually refers to a floating-point number that is stored in 8 bytes, and has (in decimal) about 15 significant digits. In contrast, single-precision is stored in 4 bytes, and has only 6-7 significant digits.
What is a Menu driven program for a stack operation?
#include
#include
#include
#define MAXSIZE 50
int a[MAXSIZE];
int top=-1;
void main()
{
int choice;
void push();
int pop();
void display();
clrscr();
do
{
printf("\nYou can do following operations on stack\n");
printf("\n1. Push");
printf("\n2. Pop");
printf("\n3. Display");
printf("\n4. Exit");
printf("\n Enter your choice");
scanf("%d",&choice);
switch(choice)
{
case 1: push();
break;
case 2: pop();
break;
case 3: display();
break;
case 4: break;
default: printf("\n Wrong input");
}
}while(choice!=4);
getch();
}
void push()
{
int value;
if(top==MAXSIZE-1)
{
printf("\n Stack is overflow");
}
else
{
printf("\n Enter the value which you want to insert");
scanf("%d",&value);
top++;
a[top]=value;
}
}
int pop()
{
int value;
if(top==-1)
{
printf("\nStack is underflow");
return(0);
}
else
{
value=a[top];
top--;
}
return value;
}
void display()
{
int i;
if(top==-1)
{
printf("\n Stack is underflow");
}
else
{
for(i=top;i>=0;i--)
{
printf("\n%d",a[i]);
}
}
}
#include < stdio.h >
#include < conio.h >
#define MAX 10
int stack[MAX],top;
void main()
{
char ch;
int choice,item;
void display();
int pop();
void push(int);
clrscr();
top=-1;
do
{
printf("1.Insertion");
printf("\n2.Deletion");
printf("\n3.Display");
printf("\nEnter your choice(1-3):");
scanf("%d",&choice);
switch(choice)
{
case 1: printf("\nEnter the item to be inserted:");
scanf("%d",&item);
push(item);
display();
break;
case 2: item=pop();
printf("\nThe item deleted is %d",item);
display();
break;
case 3: display();
break;
default:printf("Wrong choice");
break;
}
printf("\nDo you want to continue(y/n):");
fflush(stdin);
scanf("%c",&ch);
}while(ch=='y' ch=='Y');
getch();
}
void push(int item)
{
if(top==MAX-1)
{
printf("Stack Overflow");
return;
}
top=top+1;
stack[top]=item;
}
int pop()
{
int t;
if(top==-1)
{
printf("Stack Underflow");
return -1;
}
t=stack[top];
top=top-1;
return t;
}
void display()
{
int i;
printf("\nThe Stack elements are:");
for(i=0;i < =top;i++)
printf("%5d",stack[i]);
}
What does the delete operator do in addition to deallocation of memory space?
The delete operator calls the destructor of the object referenced by its operand. If the destructor is virtual, the destructor of each superclass up to the top of the inheritance hierarchy is also called, in order. If you don't define a destructor for a class, the compiler defines a default destructor that has no effect. Fundamental types (char, int, float, etc.) do not have destructors, so using delete has no other effects.
As an aside: when you use inheritance, make sure to make your destructors virtual, so that objects are properly destroyed!
Also note that you should not use C's free() on a pointer that you got from C++'s new, or use C++'s delete on a pointer you got from C's malloc(). These are not guaranteed to work, and mixing them might cause Big Bad Things to happen. In general, there is no reason to use malloc()/free() in C++ at all.
No. The subtraction operator is a binary operator that returns the result of subtracting the rhs operand from the lhs operand. The unary minus operator simply negates the rhs operand.
int x = -5; // unary minus. x is (-5)
int y = -x; // unary minus. y is (+5)
y -= x; // binary minus/assign operator. y is (+10)
--x; // unary decrement operator. x is (-6)
y -= (-x); // binary minus/assign and unary minus operators. y is(+4)
What is programming language being used in payroll system?
Without knowing which specific payroll system you are referring to it is impossible to say. However, commercial software is typically distributed in machine code. Regardless of which programming language was used to produce that machine code, you won't have access to the source code so the programming language is immaterial.
Is do-while loop executed only if the condition is true?
First the body is executed, then the condition gets checked.
The array for 4x28 consists of 4 rows and 28 columns. This means there are a total of 112 individual elements arranged in a rectangular format. Each row can contain 28 elements, and there are 4 such rows. This array can be represented visually as a grid with 4 horizontal lines and 28 vertical lines.
Refer to "OODA Loop". "OODA" stands for "observe, orient, decide and act".
What are the types of banquets?
there are mainly 2 types of banquet i.e formal & informal. formal can be divided into full formal & semi formal.