Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <curses.h>
- struct Crop {
- int Price;
- int Sale;
- char Name[8];
- };
- struct Crop AllCrops[3];
- int Beet = 0;
- int Carrot = 1;
- int Kale = 2;
- int main(void) {
- initscr();
- raw();
- cbreak();
- nonl();
- keypad(stdscr, TRUE);
- AllCrops[Beet].Price = 5;
- AllCrops[Carrot].Price = 6;
- AllCrops[Kale].Price = 7;
- strncpy(AllCrops[Beet].Name, "Beet", 7);
- strncpy(AllCrops[Carrot].Name, "Carrot", 7);
- strncpy(AllCrops[Kale].Name, "Kale", 7);
- printw("Carrots are: %i\n", AllCrops[Carrot].Price);
- printw("Beets are named: %s", AllCrops[Beet].Name);
- refresh();
- getch();
- endwin();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment