Posts

Showing posts with the label source code

C++ Project for beginners | Green house management system source code

Image
 Introduction: This program is written in C++ that allows to manage a greenhouse according to authorities given to a particular person. Each function in this program has a specific function.  In this program concept of arrays,functions and other basic concepts have been used. #include <iostream> #include <string> using namespace std; const int maxplants = 20; //list of plants void list(string plants[],int & nplants) {              for (int i = 0; i < nplants; i++) {             cout << "Plant " << i + 1 << ": " << plants[i] << endl;         }     } // Adding plants void addplants(string plants[], int& nplants) {     string choice;     do {         if (nplants >= maxplants) {             cout << "You can't add more plants." << endl;             break;         }         string plant;         cout << "Enter the name of a new plant: ";         cin >> plant;         pl

C++ project connect 4 game || source code

Image
Play the classic Connect 4 game in C++. It's a two-player game of strategy where you try to connect four pieces in a row. The game features a graphical console interface. You can win by connecting four pieces horizontally, vertically, or diagonally. The game also checks for ties. You'll use arrays, loops, and player interaction to build the game  Introduction: This C++ code creates a virtual representation of the Connect 4 game. It simulates a grid where two players drop colored disks. The goal is to connect four disks of the same color in a row, column, or diagonal before the other player does. #include<iostream> #include<windows.h> using namespace std; char conn_4[7][6]; int counter[7] = { 0 }; void print() {  system("color 06");  cout << "\t\t\t************************* CONNECT 4 GAME **************************\n\n\n";  for (int i = 5; i >= 0; i--) {   cout << endl << "\t\t\t\t\t |___|___|___|___|___|___|___|\n"