Posts

C program that simulates a basic indoor game, "Treasure Hunt".

 Here's a simplified C program that simulates a basic indoor game, "Treasure Hunt". Treasure Hunt Game #include <stdio.h> #include <stdlib.h> #include <time.h> // Define structure for rooms typedef struct {     char name[50];     char description[100];     int treasure; } Room; // Define structure for players typedef struct {     char name[50];     int score; } Player; // Function to create a new room Room createRoom(char *name, char *description, int treasure) {     Room room;     strcpy(room.name, name);     strcpy(room.description, description);     room.treasure = treasure;     return room; } // Function to create a new player Player createPlayer(char *name) {     Player player;     strcpy(player.name, name);     player.score = 0;     return player; } // Function to play the game void playGame(Room *rooms, int roomCount, P...

C program that simulates a kirana store's billing system

 Here's a simplified C program that simulates a kirana store's billing system: Kirana Store Billing Program #include <stdio.h> #include <stdlib.h> // Define structure for products typedef struct {     char name[50];     float retailRate;     float wholesaleRate;     int quantity; } Product; // Define structure for bills typedef struct {     Product product;     float rate;     int quantity;     float amount; } Bill; // Function to create a new product Product createProduct(char *name, float retailRate, float wholesaleRate, int quantity) {     Product product;     strcpy(product.name, name);     product.retailRate = retailRate;     product.wholesaleRate = wholesaleRate;     product.quantity = quantity;     return product; } // Function to create a new bill Bill createBill(Product product, float rate, int quantity) {     Bil...