Question

In: Computer Science

Write a program in structured text that tells a butterfly valve to open for 10seconds and...

Write a program in structured text that tells a butterfly valve to open for 10seconds and close thereafter.

Solutions

Expert Solution

#include<graphics.h>
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
char *buff1,*buff2;
void main()
{
int gd=DETECT,gm;
void *buff;
int area1,area2,x,y;

initgraph(&gd,&gm,"c:\\tc\\bgi");

  
ellipse(240,80,115,65,10,40);

circle(240,40,10);
ellipse(215,40,15,100,20,40);
ellipse(265,40,85,165,20,40);

ellipse(160,90,270,0,80,25);   
ellipse(160,60,0,90,80,25);
ellipse(160,75,270,90,15,40);
ellipse(320,75,90,270,15,40);

ellipse(320,90,180,270,80,25);
ellipse(320,60,90,180,80,25);

setfillstyle(SOLID_FILL,YELLOW);
floodfill(240,40,WHITE);
setfillstyle(SOLID_FILL,BLUE);
floodfill(200,80,WHITE);
floodfill(290,60,WHITE);
setfillstyle(SOLID_FILL,BROWN);
floodfill(240,80,WHITE);
setfillstyle(SOLID_FILL,GREEN);
floodfill(240,110,WHITE);


area1=imagesize(160,0,320,120);
buff1=malloc(area1);

getimage(160,0,320,120,buff1);
clearviewport();

ellipse(240,80,120,60,10,40);

circle(240,40,10);
ellipse(215,40,15,100,20,30);
ellipse(265,40,85,165,20,30);

ellipse(320,90,180,260,80,40);   
ellipse(320,60,100,180,80,40);
ellipse(310,75,105,255,15,60);

ellipse(160,90,280,0,80,40);
ellipse(160,60,0,80,80,40);
ellipse(170,75,285,75,15,60);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(240,40,WHITE);
setfillstyle(SOLID_FILL,BLUE);
floodfill(200,80,WHITE);
floodfill(290,60,WHITE);
setfillstyle(SOLID_FILL,BROWN);
floodfill(240,80,WHITE);
setfillstyle(SOLID_FILL,GREEN);
floodfill(240,110,WHITE);


area2=imagesize(160,0,320,140);
buff2=malloc(area2);
getimage(160,0,320,140,buff2);
clearviewport();

x=220;y=475;
while(!kbhit())
{
if(y==25)
y=475;
putimage(x,y,buff1,COPY_PUT);
delay(30);
clearviewport();
putimage(x,y,buff2,COPY_PUT);
delay(30);
clearviewport();
y=y-15;
}
getch();
closegraph();
}


Related Solutions

Write a GUI-based program that allows the user to open, edit, and save text files. The...
Write a GUI-based program that allows the user to open, edit, and save text files. The GUI should include a labeled entry field for the filename and multi-line text widget for the text of the file. The user should be able to scroll through the text by manipulating a vertical scrollbar. Include command buttons labeled Open, Save, and New that allow the user to open, save and create new files. The New command should then clear the text widget and...
Write a C++ program to open and read a text file and count each unique token...
Write a C++ program to open and read a text file and count each unique token (word) by creating a new data type, struct, and by managing a vector of struct objects, passing the vector into and out of a function. Declare a struct TokenFreq that consists of two data members: (1) string value; and (2) int freq; Obviously, an object of this struct will be used to store a specific token and its frequency. For example, the following object...
Language: c++ using visual basic Write a program to open a text file that you created,...
Language: c++ using visual basic Write a program to open a text file that you created, read the file into arrays, sort the data by price (low to high), by box number (low to high), search for a price of a specific box number and create a reorder report. The reorder report should alert purchasing to order boxes whose inventory falls below 100. Sort the reorder report from high to low. Inventory data to input. Box number Number boxes in...
Language: c++ using visual basic Write a program to open a text file that you created,...
Language: c++ using visual basic Write a program to open a text file that you created, read the file into arrays, sort the data by price (low to high), by box number (low to high), search for a price of a specific box number and create a reorder report. The reorder report should alert purchasing to order boxes whose inventory falls below 100. Sort the reorder report from high to low. Inventory data to input. Box number Number boxes in...
Write a C program using system call I/O to a) open an existing text file passed...
Write a C program using system call I/O to a) open an existing text file passed to your program as a command line argument, then b) display the content of the file, c) ask the user what information he/she wants to append d) receive the info from the user via keyboard e) append the info received in d) to the end of the file f) display the updated content of the file
Write a java program: Write a program that creates a text file. Write to the file...
Write a java program: Write a program that creates a text file. Write to the file three lines each line having a person's name. In the same program Append to the file one line of  'Kean University'.  In the same program then Read the file and print the four lines without lines between.
Write the program in java Write a program that does basic encrypting of text. You will...
Write the program in java Write a program that does basic encrypting of text. You will ask the user the filename of a text file which contains a few sentences of text. You will read this text file one character at a time, and change each letter to another one and write out to an output file. The conversion should be done a -> b, b->c , … z->a, A->B, B->C, …. Z->A. This means just shift each letter by...
Write a Java program that will encode plain text into cipher text and decode cipher text...
Write a Java program that will encode plain text into cipher text and decode cipher text into plain text. Create following methods and add them to your class: • a method named encode(String p, int key) that takes a plain text p and encodes it to a cipher text by adding the key value to each alphabet character of plain text p using the ASCII chart. The method should return the encoded String. For example, if p = "attack at...
Write a complete C program that read the text below and save the text in a...
Write a complete C program that read the text below and save the text in a new file "second.txt" with the same text written in all uppercase. "Beedle the Bard was an English wizard and author of wizarding fairytales. Beedle was born in Yorkshire, England. At some point in his life he wrote The Tales of Beedle the Bard . The only known image of Beedle is a woodcut that shows him with a "luxuriant" beard. Beedle wrote in ancient...
Problem 1 Write a program that prompts the user to enter an integer It then tells...
Problem 1 Write a program that prompts the user to enter an integer It then tells the user if the integers is a multiple of 2, 3, 5, 7 or none of the above. Program language is C Ex. Enter an integer 12 You entered 12 The number you entered is a multiple of 2 ----------------------------------------------- Enter an integer 11 You entered 11 The number you entered is not a multiple of 2, 3, 5, or 7
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT