Which modifications are necessary to generate dda dotted line code from dda algorithm?
What is the advantage of bresenham algorithm over dda algorithm?
Read more: What_is_the_advantage_of_bresenham_algorithm_over_dda_algorithm
Why insert operation in stack called as push operation?
Consider an array used as a stack. Align this array vertically. When an element is inserted into the stack, it is pushed all the way down despite the space availability at the top. Hence it is called push operation. Here's an illustration:
Stack initially:
|_|
|_|
|_|
|5|
Stack after the insertion of 6:
|_|
|_|
|6| - element pushed down as much as possible
|5|
A
How do you write a program in c to display numbers from 0 to 9 along with the string?
#include <stdio.h>
int main (void)
{
puts ("0123456789");
return 0;
}
Can you give an example of array program?
int main (int argc, char *argv[])
{
int i;
for (i=0; i<argc; ++i) printf ("%2d: %s\n", i, argv[i]);
return 0;
}
Length of a string using strlen?
char mystring[] = "This is a string"; int mystringlength = strlen(mystring); /* mystringlength is now 16 */
Why is there no threading for post order traversal of a binary search tree?
You don't need it. Think about it, you can just use a stack (or a recursive function.)
Which element of array does this expression refer num5?
which element of the array does this expression reference num[5]
How do you read and write a bmp file in VHDL?
Where f0.bmp is an eight square picture: This is OK up to the penultimate line can anyone resolve this bit/byte and perhaps post it on the Xilinx Virtex forum! See Xilinx forum on Virtex FPGA's http://www.xilinx.com/cgi-bin/SW_Docs_Redirect/sw_docs_redirect?locale=en&topic=support
Do you need to deallocate memory when an object is not in use?
Be more specific with your question:
Java: deallocation is always automatic
C++: objects allocated with new have to be released with delete
Which is preffered in C malloc or new why?
C does not have a new operator, so we must use the malloc function.
In C++ we prefer the new operator over malloc. The new operator not only allocates memory to an object, it invokes that object's constructor, thus ensuring correct initialisation of the object, thus establishing the object's invariant (if it has one). If construction fails for any reason, an exception will be thrown and no object will be instantiated. If the class designer has made correct use of resource acquisition is initialisation(RAII), any resources consumed by the constructor prior to throwing the exception will be automatically returned to the system, thus ensuring no resource leaks occur.
The sole purpose of malloc is to allocate memory and nothing more. If the allocation fails, a null pointer is returned, otherwise the start address of the allocation is returned. However, the memory is left in an uninitialised state even if the object has a constructor. Moreover, neither malloc, calloc nor realloc will throw exceptions so they are unsuitable for enabling RAII. The only reason they exist at all in C++ is simply for the sake of backward compatibility with C code which cannot use the new operator (since it does not exist in C).
How do you program reverse letters using arrays in C plus plus?
char * RevString( char * str )
{
char * dup = strdup( str );
size_t len = strlen( str );
int x = 0;
int y = len;
while( x str[ x++ ] = dup[ --y ]; free( dup ); return( str ); } Note that you don't actually need this function since the standard built-in strrev() function reverses strings more efficiently than this.
Write a program to find the largest of n numbers in c?
Without Using Arrays
Program:
#include<stdio.h>
main()
{
int n,m,i,max;
printf("How many numbers(n) you going to enter:");
scanf("%d",&n);
printf("Enter the numbers:");
scanf("%d",&m);
max=m;
for(i=2;i<=n;i++)
{
scanf("%d",&m);
if(m>max)
max=m;
}
printf("The Largest Number is %d",max);
}
Output:
How many numbers(n) you going to enter:5
Enter the numbers:
25
410
362
5
56
The Largest Number is 410
With Using Arrays
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int max_num(int a[],int n);
int max,i,n;
int a[50];
clrscr();
printf("Enter n number:");
scanf("%d",&n);
printf("Enter the numbers:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
max=max_num(a,n);
printf("The largest number is %d",max);
getch();
}
int max_num(int a[],int n)
{
int i,m=0;
for(i=0;i<n;i++)
{
if(a[i]>m)
m=a[i];
}
return m;
}
output:
Enter n number:10
Enter the numbers:
123
456
789
963
852
147
5
56
600
753
The largest number is 963
How do you get loop the loops in theme park ds?
when you get bonuses or when your making good money you put a bit of money in your ride research and say you put 1900 on it wait about 3-4 years and it should nearly be there if you are at the roller coaster
C programming are converted into machine language with the help of?
A software tool called a "compiler" translates C programs into the underlying machine language for the system you are using. The C program is called "source code" and the compiled program is called "object code".
If you compile a program that will run on a completely different type of system, then it's called "cross compiling." Cross compiling requires a special compiler. For example, when you compile an application for the iPhone, you're compiling it on an computer that uses an Intel processor, but the actual program will run on an ARM based processor.
A pointer to a function which receives nothing and returns nothing?
void (*funptr)(void);
void fun (void);
int main ()
{
funptr = fun;
funptr ();
}
Flow chart to compute the average of N number?
Where:
variable_A contains the first number, variable_B contains the second number, variable_Sum contains the sum of variable_A and variable_B, and variable_Ave contains the average of variable_Sum.
The last time I checked the LETTER "N" is not a number
How do you run dev-c plus plus on Windows 8?
I don't run either DevCPP or Windows 8. However, I did some checking around and found the following answers. The related links to them are provided beneath this answer.
1) Run DevCPP in Windows XP Compatibility Mode: right-click the icon and select "Run in earlier versions of Windows"
2) Update DevCPP (see the SourceForge related link below)
The problem seems to be that you're running an outdated version of MinGW GCC.
If neither of the above answers help, try a Web search for devcpp "windows 8" or devc++ "windows 8".
Also, keep in mind that Windows 8 is still in beta development, so expect errors and problems to crop up. I'd recommend sticking with earlier Windows versions until at LEAST a service pack gets released if you continue to encounter technical difficulties and are unable to find answers on the Web.
What multiplication fact can be found by using the arrays for 2x9 and 5x9?
The multiplication fact (singular, not plural 'facts') that can be found is 7x9 = 63.
Using the arrays,
a 2x9 array (2 rows of 9 items) and 5x9 array (5 rows of 9 items) is 63:
2x9 = 18
5x9 = 45
18 + 45 = 63
We can use any method. As we can find out the area of the circle by three methods as i known.
1.ordinary programming
e.g. void main() {
int r;float area;
printf("\n\tEnter radius of the circle : "); scanf("%d",&r); area=3.14*r*r; printf("Radius = %d and area=%f",r,area); } 2. By using macros e.g. #define PI 3.14
#define AREA(x) PI*x*x 3. We can solve by user defined functions also
#include<stdio.h>
#include<stdlib.h>
typedef struct Node
{
int data;
struct Node *next;
}node;
void insert(node *pointer, int data)
{
/* Iterate through the list till we encounter the last node.*/
while(pointer->next!=NULL)
{
pointer = pointer -> next;
}
/* Allocate memory for the new node and put data in it.*/
pointer->next = (node *)malloc(sizeof(node));
pointer = pointer->next;
pointer->data = data;
pointer->next = NULL;
}
int find(node *pointer, int key)
{
pointer = pointer -> next; //First node is dummy node.
/* Iterate through the entire linked list and search for the key. */
while(pointer!=NULL)
{
if(pointer->data == key) //key is found.
{
return 1;
}
pointer = pointer -> next;//Search in the next node.
}
/*Key is not found */
return 0;
}
void delete(node *pointer, int data)
{
/* Go to the node for which the node next to it has to be deleted */
while(pointer->next!=NULL && (pointer->next)->data != data)
{
pointer = pointer -> next;
}
if(pointer->next==NULL)
{
printf("Element %d is not present in the list\n",data);
return;
}
/* Now pointer points to a node and the node next to it has to be removed */
node *temp;
temp = pointer -> next;
/*temp points to the node which has to be removed*/
pointer->next = temp->next;
/*We removed the node which is next to the pointer (which is also temp) */
free(temp);
/* Beacuse we deleted the node, we no longer require the memory used for it .
free() will deallocate the memory.
*/
return;
}
void print(node *pointer)
{
if(pointer==NULL)
{
return;
}
printf("%d ",pointer->data);
print(pointer->next);
}
int main()
{
/* start always points to the first node of the linked list.
temp is used to point to the last node of the linked list.*/
node *start,*temp;
start = (node *)malloc(sizeof(node));
temp = start;
temp -> next = NULL;
/* Here in this code, we take the first node as a dummy node.
The first node does not contain data, but it used because to avoid handling special cases
in insert and delete functions.
*/
printf("1. Insert\n");
printf("2. Delete\n");
printf("3. Print\n");
printf("4. Find\n");
while(1)
{
int query;
scanf("%d",&query);
if(query==1)
{
int data;
scanf("%d",&data);
insert(start,data);
}
else if(query==2)
{
int data;
scanf("%d",&data);
delete(start,data);
}
else if(query==3)
{
printf("The list is ");
print(start->next);
printf("\n");
}
else if(query==4)
{
int data;
scanf("%d",&data);
int status = find(start,data);
if(status)
{
printf("Element Found\n");
}
else
{
printf("Element Not Found\n");
}
}
}
}