Hello everyone,
I am making a Monopoly type game using linked lists and functions.
Basically the linked lists will store each user, number of houses, and number of hotels, and properties.
This is what we were given to work with.
Code:
struct property {
char name[30];
int user;
int num_houses;
int num_hotels;
struct property * next;
};
We also need functions for buying, selling, and improving properties.
I have all the small things done with my code but I really need some guidance on linked lists and functions.
Here is my code right now
Code:
#include <stdio.h>
#define HOUSE 25
#define HOTEL 50
#define PROPERTY 100
struct property {
char name[30];
int user;
int num_houses;
int num_hotels;
struct property * next;
};
//Buy function (search for name and add to linked list)
//Improve function (Add hotel or house, add to linked list)
//Sell function (Print amount property is worth + hotels and houses, remove property from linked list)
int main () {
int num_players, selection, count;
printf("Welcome to Monopoly!\n");
printf("How many players will there be?\n");
scanf("%d", &num_players);
printf("Enjoy your game!\n");
count = 1;
do {
if (selection == 5)
count ++;
if (count > num_players)
count = 1;
printf("Player %d what would you like to do?\n", count);
printf("\t1-Buy Property\n");
printf("\t2-Improve Property\n");
printf("\t3-Sell Property\n");
printf("\t4-View Properties\n");
printf("\t5-End Turn\n");
printf("\t6-End Game\n");
scanf("%d", &selection);
//Selection Results
}
while (selection != 6);
//if (selection == 6)
//End game function
return 0;
}
any nudges would be greatly appreciated
Edit: I know a little about how to use functions (still very shaky, trying to read as much as I can to understand better) but I am completely lost when it comes to linked lists