Nofew

WHEEEEEE!!!

May 27th, 2016
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include <curses.h>
  2.  
  3. struct Crop {
  4.     int Price;
  5.     int Sale;
  6.     char Name[8];
  7. };
  8.  
  9. struct Crop AllCrops[3];
  10.  
  11. int Beet = 0;
  12. int Carrot = 1;
  13. int Kale = 2;
  14.  
  15. int main(void) {
  16.     initscr();
  17.     raw();
  18.     cbreak();
  19.     nonl();
  20.     keypad(stdscr, TRUE);
  21.  
  22.     AllCrops[Beet].Price = 5;
  23.     AllCrops[Carrot].Price = 6;
  24.     AllCrops[Kale].Price = 7;
  25.     strncpy(AllCrops[Beet].Name, "Beet", 7);
  26.     strncpy(AllCrops[Carrot].Name, "Carrot", 7);
  27.     strncpy(AllCrops[Kale].Name, "Kale", 7);
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.     printw("Carrots are: %i\n", AllCrops[Carrot].Price);
  35.     printw("Beets are named: %s", AllCrops[Beet].Name);
  36.     refresh();
  37.     getch();
  38.  
  39.     endwin();
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment