/*This is a simple Program*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
int main()
{
int curfl = 0, destfl, floor;
float high, speed;
float time1;
high = 3.0; // Height of the floor
speed = 5.0; // Speed of the elevator per second
while(1)
{
printf("Currently the elevator is at floor number = %d\n", curfl);
printf("Enter the floor number between 0-25 : ");
// printf("%d %d", &curfl, &time1);
scanf("%d", &destfl);
if(destfl > curfl)
{
floor = destfl - curfl;
time1 = (floor * (high / speed));
printf("Elevator will take %.2f second to reach %d (st, nd, rd) floor \n", time1, destfl);
while(curfl != destfl)
{
Sleep((1000 * 3) / 5);
curfl++;
printf("You are at floor number %d \n", curfl);
}
printf("Door opening \n");
Sleep(10000);
printf("Door Closed\n \n");
}
else if(destfl < curfl)
{
floor = curfl - destfl;
time1 = (floor * (high / speed));
printf("Elevator will take %.2f second to reach %d (st, nd, rd) floor \n", time1, destfl);
while(curfl != destfl)
{
Sleep((1000 * 3) / 5);
curfl--;
printf("You are at floor number %d \n", curfl);
}
printf("Door opening \n");
Sleep(10000);
printf("Door Closed\n \n");
}
else{
printf("You are the same floor. Please getout from the elevator \n");
}
}
// printf("Hello world!\n");
return 0;
}
Write and run a client and a server program in C-language using UDP
Yes.
Yes, you can write a program in C language which connects to a database.
first think of the logic and then write the statements
Write a program in c++ that take input in a integer matrix of size 4*4 and find out if the entered matrix is diagonal or not.
Write and run a client and a server program in C-language using UDP
Yes.
You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.
Yes, you can write a program in C language which connects to a database.
write a program to print A to Z on screen in c?
ponka
first think of the logic and then write the statements
to implement operations on binary heap in c
here you go nah...
int pallindrom(int p){ /*write all logic*/ }
if u give control ratios used in budgeting i can write program in C/C++
Write a program in c++ that take input in a integer matrix of size 4*4 and find out if the entered matrix is diagonal or not.