Write a program to act as an electronic safe, C/C++ Programming

Assignment Help:

Write a program to act as an electronic safe. If the correct code has been entered the program should display "Safe Open".  If an incorrect code is input it should display "Alarm" and cannot be reset.
 
#include stdio.h
void main()

  char prompt;
  int dial,code;
/* set up code */
  printf("Please enter in the numerical code \n\r");
  scanf("%d",&code);
/* Lock up safe */
  printf(" Safe locked \n\r Please enter access ... ");
  scanf("%d",&dial);
  while (dial != code )
  {
    printf("Alarm sounded \n\r");
 
  }
  printf("Safe opened \n\r"); 
  printf("Press any key to exit \n\r");
  scanf("\n%c",&prompt); 
  }


Related Discussions:- Write a program to act as an electronic safe

C program, Write a ‘C’ program to accept any 3 digit integer number from th...

Write a ‘C’ program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

What are the benefits of using friend classes, What are the benefits of usi...

What are the benefits of using friend classes? - Friend classes are useful when a class wants to hide features from users which are required only by another, tightly coupled cl

Define difference among delete and delete[]?, when you allocate memory with...

when you allocate memory with new[], you ought to free the memory via delete[]. While you allocate memory along 'new', then use 'delete' with no the brackets. You employ new[] to a

Program of cascading, Program of cascading: class vector{          ...

Program of cascading: class vector{                 private :                 int v[3];                   public:                 friend istream & operator >> (

Should my class declare a friend function or member function, A: Use a memb...

A: Use a member while you can and a friend when you need to. Sometimes friends are better syntactically (e.g., in class Fred, friend functions let the Fred parameter to be secon

Assigment, Hi is there any chance to get assignment for fresher tutor

Hi is there any chance to get assignment for fresher tutor

C/c++, Byteland county is very famous for luminous jewels. Luminous jewels ...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Compiler design limiting instruction, Ravi is a newbie to the programming a...

Ravi is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''''{'''' and end with ''''}

Sequence for DMA controller, Write a sequence of instructions that transfer...

Write a sequence of instructions that transfers data from memory to an external I/O device by using channel 3 of the 8237 DMA controller. Transfer from 20000H-20FFFH.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd