Logo  

CS256 - Fundamentals of Structured Programming

Displaying exercises/e8/files/p2.c

#include <stdio.h>
#include <string.h>
#include <curses.h>

/**
 * Complete this function to print a prompt where the right edge of the prompt
 * ends up at the x,y location, then use scanw() to get an integer and return
 * the read integer as this functions value.
 * ex:
 *    Prompt? 
 *           ^ x,y should be here.
 * Use the strlen() function to get the length of the prompt string.
 * NOTE: This function should do these things, the program is incomplete if it
 * does not.
 */
int getint(int y, int x, char prompt[])
{

}

/**
 * Complete the main function to read two integers using the getint() function,
 * prompting for an X and Y value.  Clear the screen and print a "Hello, world!"
 * message at the location the user input.  Then wait for the user to press
 * a key to quit the program.
 */
int main(void)
{
  // Do not modify the following code:
  initscr();

  int x = getint(10, 10, "X? ");
  int y = getint(11, 10, "Y? ");

  // Put your code here:



  endwin();
  return 0;
}