What does a dashed arrow mean in a flow chart?
An arrow is used in a flowchart because it links one part to another. For example, a flow chart describing the process of electric energy:
[Power plant] ---> [Transformer] ---> [Power lines] ---> [Transformer] ---> [House] ---> [Transformer] ---> [Device]
As you can see, the arrows show the direction of where the flow chart is leading, telling the viewer where to begin, and where the to.
Program for stop and wait protocol in c language?
/*************************************************************************************/
/* C program to implement stop and wait protocol*/
/* Download more programs at http://sourcecode4u.com/ */
/*************************************************************************************/
#include<stdio.h>
#include<conio.h>
#define MAXSIZE 100
typedef struct
{
unsigned char data[MAXSIZE];
}packet;
typedef enum{data,ack}frame_kind;
typedef struct
{
frame_kind kind;
int sq_no;
int ack;
packet info;
}frame;
typedef enum{frame_arrival}event_type;
typedef enum{true_false}boolean;
void frame_network_layer(packet *p)
{
printf("\n from network arrival");
}
void to_physical_layer(frame *f)
{
printf("\n to physical layer");
}
void wait_for_event(event_type *e)
{
printf("\n waiting for event n");
}
void sender(void)
{
frame s;
packet buffer;
event_type event;
printf("\n ***SENDER***");
frame_network_layer(&buffer);
s.info=buffer;
to_physical_layer(&s);
wait_for_event(&event);
}
void from_physical_layer(frame *f)
{
printf("from physical layer");
}
void to_network_layer(packet *p)
{
printf("\n to network layer");
}
void receiver(void)
{
frame r,s;
event_type event;
printf("\n ***RECEIVER***");
wait_for_event(&event);
from_physical_layer(&r);
to_network_layer(&r.info);
to_physical_layer(&s);
}
main()
{
sender();
receiver();
getch();
}
How can you calculate the c program running time through c plus plus coding?
This is a big question... but I'll try for a shortish answer. Try to do things in approximately the following order.
1) Use the right algorithms. Look into the Big O efficiency of any algorithms you are using, and make sure there aren't more efficient algorithms available.
2) Think about trading using more memory for a faster algorithm. Perhaps pre-computing tables of intermediate results.
3) Use a profiler to see where the bottle necks are and try improving them.
4) Optimize the inner most loops using assembly language to get the last little bit faster.
5) Run it on a faster computer.
6) Make it run in parallel across many computers or CPUs. This is especially good on the newer Intel chips where you have access to multiple CPUs on one chip. Distributed network computing sometimes is a good idea. Cloud computing is another possibility these days.
7) Make sure that C really is the right answer. It might not be in all cases.
A more specific question might yield a more specific answer.
Why JVM is platform independent?
by creating a jre spesific to each platform programmers can confidently write code in any platform and assume it willl also work in aany other. theirfore java is platform independent as bytecode would look the same on any platform, however will be implemented by a diffrent interpreter for each platform.
What do you call a Program that runs Java byte code instruction?
Get the JDK & Bluej from net and the rest will be done by them.
Java byte codes are stored as *.class ; where "*" represents the class name, in your hard disk.
You can download BlueJ as well as JDK from the related link.
Write a program to convert hexadecimal to decimal numbers?
write an assembly language program to implement a stack. START: LXI SP,STACK ;initialize stack pointer
LXI H,BINBYT ;point HL index to where binary number is stored
MOV A,M ;transfer byte
LXI H,OUTBUF ;point HL index to output-buffer memory
CALL BINBCD
HLT BINBCD:
MVI B,100 ;load 100 into register B (power of ten holding register)
CALL BCD ;call conversion for BCD3
MVI B,10 ;load 10 into register B
CALL BCD ;call conversion for BCD2
MOV M,A ;store BCD1
RET
Algorithm in creating insert method in linked list?
You sort a doubly linked list the same way you sort any other kind of list or array.
You implement a procedure to sort the list or array, and that procedure calls the appropriate insert, delete, or move methods of the list or array.
How do you find the diameter of a length of string?
You use the diameter formular. You know, C=pi(d).
If you know the cicumference, then you use this equation, d=c/pi.
You subsitute the cimcumference and divide (pi=3.14), and that's how you calculate dimater. Oh yeah, and if your given the radius of the circle, just multiply it by two.Type your answer here...
What is a member of a primitive or uncivilised people?
They once were known as savages, but the term has been lately used to descibe anyone with barbaric tendencies.
What is pointer variable range?
The range of a pointer variable is the range of addressable memory. For a 32-bit system there are 2^32 addresses ranging from 0x0 to 0xffffffff. Address 0x0 is a reserved address and is used to indicate a pointer refers to no object in particular (points to null).
Depending on the word-alignment requirements of the architecture, certain addresses may be deemed invalid for a given type. For instance, a 4-byte integer is generally faster to access if it is aligned upon a 4-byte boundary.
What is significance attached to the main function in C programming?
The main function in C++ is no different to any other function, other than it is the only required function; it defines the entry point of the application. The minimal main function (and therefore the minimal C++ program) is:
#include <stdio.h>
int main()
{
return(0);
}
The main function must always return an integer to the caller (even if not required by the caller). A return value of zero is usually used to indicate the program terminated successfully, however it is up to the programmer to decide what the return value actually means to the caller. It is common to return (-1) upon an unrecoverable error.
C program to calculate area of circle?
/*to find the area of a circle*/
#include<stdio.h> #include<conio.h> main()
{
int r;
float a;
print f ("Enter r value \n");
scan f ("%d", &r);
a=3.14*r*r;
print f("area=%f",a);
}
How do you write a program in VB to compare three number and print larger number?
' Return the maximum of a,b,c
Function max(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer) As Integer
Dim maxAB As Integer
maxAB = Math.Max(a, b)
Return Math.Max(maxAB, c)
End Function
2 Write an algorithm to print the factorial of a given number?
include<stdio.h>
main()
{
int n,fact=1;
clrscr();
printf("enter a no");
scanf("%d",&n);
while(n>0)
{
fact=fact*n;
n--;
}
printf("the factorial of given no is %d",fact);
getch();
}
What is meant by the storage class of a variable?
auto, extern, static, register, typedef (only formally)
C program asking to enter string?
its simple in c and c++: mainly it depends on what type of answer ur looking track fro the user .. if its a numeric u can define a integer or float variable else a string variable to store characters . ex : printf("\n whats ur age ?"); scanf("%d",&age); printf("\n hey ur %d years old :",age); cout
What is mean by robust language in c language?
Robust means strong enough to withstand or overcome intellectual challenges or adversity.
c is a robust language because its rich set of built-in functions and operators can be used to write any complex logic program.
How do you calculate the time complexity of selection sort?
Suppose (for simplicity) that n = 2k for some entire k. Let T(n) the time used to sort n elements. As we can perform separation and merging in linear time, it takes cn time to perform these two steps, for some constant c. So, T(n) = 2T(n/2) + cn.
In the same way:
T(n/2) = 2T(n/4) + cn/2, so
T(n) = 4T(n/4) + 2cn. Going in this way ... T(n) = 2mT(n/2m) + mcn, and
T(n) = 2kT(n/2k) + kcn = nT(1) + cnlog2n = O(n log n). Remember, as n=2k k = log2n! The general case requires a bit more work, but it takes O(n log n) time anyway.
Code for first fit algorithm in C?
#include <stdio.h>
#include <conio.h> //function to print the bins:
void printBins(float bins [500] [500],int items )
{
for (int j=1;j<=items;j++)
{
for (int i=1;i<=items;i++)
{
printf(" %1.3f",bins[i][j]);
}
printf("\n");
}
} int main()
{
int items, x=1,c=1, i=0, j=1, countOfBins=1;
float z,sum=0 ,inputitems[500], bin[500][500]; printf("Enter the number of items:");
scanf("%d", &items); //scanning how many elements the user wants to enter
if (items<=0)
{
printf("Can't bin-pack on zero elements");
getch();
}
else
{
do{
printf("\nEnter item number %d: ",x);
scanf ("%f",&z); //scanning the elements the user inputs if ((z<0)(z>1)) //assuming my bins range from 0 to 1 only
{
printf ("\nitem number %d is not in range of 0 to 1",x);
goto stop;
}
else //if all the inputs were in the correct range
{
inputitems[x]=z; //save my elements in an array called inputitems
x++;
}
}while (x<=items); //end of do-while statement
//technique number 1:
printf ("\nIn Next Fit online technique:");
loop:
while (c<=items)
{
if (sum+inputitems[c]<=1) //to check if you have any more room to fit in the bin
{
i++; //assuming that each row represents a bin
bin[i][j]=inputitems[c]; //place element from inputitems array into a 2D array called bin
sum += inputitems[c];
c++;
goto loop; //go back to the while statement to check condition
}
else
{
j++;
countOfBins++; //to count the number of bins we used
i=1;
sum=0;
bin[i][j]=inputitems[c];
sum += inputitems[c];
c++;
goto loop;
} } //end of while loop printf("\nNumber of bins used: %d \n", countOfBins);
printf("\nstructure of bin\n(FYI any empty rows shown, are equal to the number of items that you have entered)\n");
printBins(bin,items);//to print the bins used with their elements //end of first technique, can;t stop: getch();
}//end of very first else }//end of main //I could not figure out any of the other 4 techniques of Bin Packing... any help please?
Write a c program to print fibonacci series using do while loop?
#include<iostream>
using namespace std;
#define MIN 1
#define MAX 1000000
int main()
{
int num;
char c;
do
{
cout << "Enter a number from " << MIN << "-" << MAX << " (0 to quit): ";
cin >> num;
while(cin.fail() num < 0 num > MAX)
{
if( cin.fail() )
{
cin.clear();
cin >> c;
}
cout << "Invalid number, try again: ";
cin >> num;
}
if(num)
{
cout << "\nFibbonacci series for n, where 1 <= n <= " << num << ":\n\n";
int n = 1, x = 0, y = 0;
do
{
cout << n;
x = y;
y = n;
n = x + y;
if( n < num )
cout << ", ";
}while( n < num );
cout << endl << endl;
}
}while( num );
return( 0 );
}
What is return a void data type?
#include<stdio.h>
int main(){
int num,i,f,r,sum=0,temp;
printf("Enter a number: ");
scanf("%d",&num);
temp=num;
while(num){
i=1,f=1;
r=num%10;
while(i<=r){
f=f*i;
i++;
}
sum=sum+f;
num=num/10;
}
if(sum==temp)
printf("%d is a strong number",temp);
else
printf("%d is not a strong number",temp);
return 0;
}
Why getch function has semicolen?
Without the semi-colon, getch is just an expression, not a statement.
What are the applications of merge sort?
Applications of heap sort
Is C a pure Object Oriented Programming Language?
High. Only machine code and Assembly are low level languages.
The distinction most usually used to determine if a language is 'high' or 'low' is the use of a compiler. If a language requires some form of compilation or translation process to convert each written instruction into multiple machine executable instructions then it is a high-level language. If each written instruction can be directly converted to a single machine executable instruction (and usually back again) then it is low-level.
Comment statement of BASIC programming language?
In original Standard BASIC comments were indicated by a "REM" (short for "REMARK") statement.
So, if "REM" was the first characters on a line, the rest of the line was treated as a comment and ignored by the interpreter or compiler.
Later dialects of "Structured" Basic use exclamation points (!) or single quotes (') to indicate the start of a comment
Some dialects require the exclamation point or single quote to be the first character on the line, others allow them to appear later in the line after executable code.
Most dialects still support the REM notation as well.