User Profile
Collapse
-
I want to output the draw button up top. What this code needs to do is execute, run and wait for the user to enter "QUIT". Then after doing so, the program will then terminate. Thats what I need my do/while loop to do -
Having trouble coming up with a do/while loop
void draw_button( const Point & upper_left)
{
cwin <<Message(Point (12,20),"Click for new location and enter label");
string a1="";
Point topleft = upper_left;
a1 = cwin.get_string (a1);
topleft.move(-.5*LETTER_WIDTH ,.1*LETTER_HEIG HT);
Point topright = topleft;
topright.move(( a1.length()+1)* LETTER_WIDTH,0) ;
Point botleft = topleft;... -
Mud
MUD
Back before there were real video games, people used to lose hour upon hour playing text based role playing games called MUDs. The basic jist of the games were that you were in some map partitioned into square blocks. From that block you could travel up, down, left, or right into an adjacent block. Sometimes you would run into a wall or find a fiendish dragon or worse in the adjacent cell; at which point you would make the exciting... -
A fun but difficult program
For this assignment you will write a function which takes as parameters the upper left corner of a button and a string representing the "label" of the button. The function will write the label to the screen with a rectangle drawn around it. The upper left hand corner of the rectangle will be the point sent to the function as a parameter. The declaration of the function is as follows:
//! \brief Draw a button in the drawing window... -
Body of For loop
Assume the int variables i and result , have been declared but not initialized. Write a for loop header -- i.e. something of the form
for ( . . . )
for the following loop body:
result = result * i;
When the loop terminates, result should hold the product of the odd numbers between 10 and 20.
NOTE: just write the for loop header; do not write the loop body itself. -
Sequence of statements
Given that two int variables, total and amount , have been declared, write a sequence of statements that:
initializes total to 0
reads three values into amount , one at a time.
After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ). -
for loop
Assume the int variables i , lo , hi , and result have been declared and that lo and hi have been initialized.
Write a for loop that adds the integers between lo and hi (inclusive), and stores the result in result .
Your code should not change the values of lo and hi . Also, do not declare any additional variables -- use only i , lo , hi , and result . -
Integer Parameters
Write the definition of a function min that has two int parameters and returns the smaller. -
Integer Variables
Given the integer variables x , y , and z , write a fragment of code that assigns the smallest of x , y , and z to another integer variable min .
Assume that all the variables have already been declared and that x , y , and z have been assigned values).
No activity results to display
Show More
Leave a comment: