Posts

Clippy Game using c++ programming

#include <iostream> #include <conio.h> #include <cstdlib> #include <ctime> #include <string> #include <sstream> using namespace std; void guide(); void body(); void display(char[][9]); // For display of screen void Hint(int); int main() { char choice; body(); cout << "Enter N for new game Q to quit the game"; cin >> choice; if (choice == 'N' || choice == 'n') { system("cls"); body(); } else if (choice == 'q' || choice == 'Q') { exit(0); } } void body() { srand(time(0)); int x, y; int arr[9][9]; string enter; char ar[9][9]{ { '.', '.', '.', '.', '.', '.', '.', '.', '.' }, { '.', '.', '.', '.', '.', '.', '.', '.', '.' }, { '.', '.', '.', '.', '.', &#

Snake Game using c++ programming

#include <iostream> #include<windows.h> //Library used to add sleep function #include<conio.h> #include<stdlib.h> //Library used for random numbers using namespace std; //Taking Global Variables bool gameOver; //Taking constant variables for arena width and height const int width = 20; const int height = 20; //taking an array for the size of snake int tailX[50], tailY[50]; int nTail; //Variables for position of player and fruit int x, y, FruitX, FruitY, score; //Setting enumerators for fixed direction enum eDirection { STOP = 0, LEFT, RIGHT, UP, DOWN }; eDirection dir; void Settings() { //1 //Setting the game to start //Setting gameover to false to start the game gameOver = false; //Setting direction to stop so snake will not be moving at the start of game dir = STOP; //Setting the location of snake at the centre of arena at the start of game x = width / 2; y = height / 2; //using random operator to randomize our fruit in the map FruitX =

Hospital Management System in c++

#include<iostream> #include<string> using namespace std; class Quarentine_Center{ protected: int center_id, quantity_of_bed;int no_of_patients; string location, contact_no; public: Quarentine_Center(int a,int b,int e,string c,string d) { center_id = a; if (b <= 20) { quantity_of_bed = b; } else cout << "Beds are not enough" << endl; if (e <= 20) no_of_patients = e; else cout << "Beds are not enough" << endl; location = c; contact_no = d; } void centerdetail() { cout << "Quantity of beds are:" << quantity_of_bed << endl; cout << "Number of patients are:" << no_of_patients << endl; cout << "Location is:" << location << endl; cout << "Contact number is:" <<contact_no << endl; } }; class Person{ protected: int person_id[20], age[20]; string first_name[20], last_name

Calculator using c++ Programming

#include<iostream> using namespace std; void add(); void subtract(); void divide(); void multiply(); int main() { int a; cout << "Enter 1 for add:" << endl; cout << "Enter 2 for subtract:" << endl; cout << "enter 3 for divide:" << endl; cout << "Enter 4 for multiply:" << endl; cin >> a; if (a == 1) { add(); } if (a == 2) { subtract(); } if (a == 3) { divide(); } if (a == 4) { multiply(); } getchar(); getchar(); return 0; } void add() { int a, b,c; cout << "Enter the 1st value:"; cin >> a; cout << "Enter the 2nd value:"; cin >> b; c = a + b; cout << "Sum is " << c << endl; } void subtract() { int a, b, c; cout << "Enter the 1st value:"; cin >> a; cout << "Enter the 2nd value:"; cin >> b; c = a - b; cout << "Subtr

Quiz Game in c++ Programming

#include<iostream> #include "stdio.h" #include<string> #include<conio.h> using namespace std; int start(); int rule(); int history(); int main() { int v; cout << "\n\n\t\t\t * Quiz Game *"; cout << "\n\n\t\t\t *************"; cout << "\n\n\t\t=============================================================="; cout << "\n\n\t\tDeveloped By :Faisal Abdul Ghani , Abdul Wahab And Bilal zahid "; cout << "\n\n\t\t=============================================================="; cout << "\n\n"; cout << " press 1 for play \n press 2 for setting \n press 3 to exit the game"; cin >> v; if (v == 1) { start(); } } int start() { int c, n; char name[100]; cout << "\n Please Enter Your Name : "; cin >> name ; cout << "\n\n"; cout << "\n\n\t\t Welcome " << name &l

Ticket Management System in c++

#include<iostream> #include<fstream> #include<string> using namespace std; struct Data { int tickets; int id; int seats; string airline, place; string choose; string Fname; string Lname; string passportNo; string CNIC; }; ofstream seat; ofstream name; ofstream cancel; ifstream full; Data a, b[200]; void data(); void internatinal(); void local(); void getData(); void seatsData(); void ticket(); void aboutUs(); int main() { int x; cout << " ==============================================" << endl; cout << " ---------AIRWAYS RESERVATION----------------" << endl; cout << " ---------- MAIN MENU---------------- " << endl; cout << " ---------ENTER YOUR CHOICE------------" << endl; cout << endl; cout << endl; cout << endl; cout << " PR

Program to find the l.c.m of two numbers in c++

#include<iostream> using namespace std; int main() { int a, b,l; cout << "Enter the value of a and b:"; cin >> a >> b; for (l = 1; l <= a*b; l++) { if (l % a == 0 && l % b == 0) break; } cout << " LCM is" << l; getchar(); getchar(); return 0; }

Program to find the new numbers

#include<iostream> using namespace std; int main() { int a,mid,sp=0,ep=5; cout << "enter the value of a:"; cin >> a; mid = (sp + ep) / 2; if (a >= 0 && a <= 2) { if (a >= 0 && a<=1) { if (a == 0) { cout << "No is 0"; } else { cout << "No is 1"; } } else { cout << "NO is 2"; } } else if (a >= 3 && a <= 5) { if (a >= 3 && a <= 4) { if (a == 3) { cout << "No is 3"; } else { cout << "no is 4"; } } else { cout << "No is 5"; } } getchar(); getchar(); return 0; }

Program to use vectors in c++

#include<iostream> #include<vector> using namespace std; int main() { vector<int>arr(5); for (int i = 0; i < arr.size(); i++) { arr[i] = 0; } arr.push_back(5); cout << "1st value is:" << arr.front() << endl; cout << "Last value of the array is:" << arr.back() << endl; cout << "To see the 3rd index:" << arr.at(3) << endl; for (int i = 0; i < arr.size(); i++) { cout << "Values of the array are:" << arr[i] << endl; } getchar(); getchar(); return 0; }

Program to use the enum in c++

#include<iostream> using namespace std; enum days{ sat=0, sun, mon, teu, wed, thirs, fri }; void main() { int no; enum days d; cout << "Enter the day:"; cin >> no; d = (days)no; if (d ==sat || d == sun){ cout << "Holidays" << endl; } else cout << "Working days" << endl; getchar(); getchar(); }

How does Technology Impact Society?

Image
      How does Technology Impact Society? Technology affects society in aspects as diverse as agriculture, education, communication, politics, work or transportation. It is a tool that has modified the way society develops. In the last centuries, technological development was planned by the few, mainly by the rich. However, today technology is available to almost everyone. Let's think about the fact that most people own a smartphone / cell phone, which is a technological device. With this, it has been observed that the use of technical equipment has become practically unavoidable. In fact, technology is so condensed in human organizations that some writers even claim that it is the heart of modern society. There are several studies that strengthen this theory. Coeckelbergh (2012), in his lesson on how I learned to love robots  Key aspects affected by technology Currently, technology and human life cannot be separated, they are co-dependent elements. Human uses technology to facili

Types of technology

Image
                                  Technology Types                                           By the middle of the 20th century, humans had learned to exit the Earth's atmosphere using technology. The invention of the integrated circuit gave rise to the computer revolution. Technology is a group of studies or sciences related to practical and industrial arts and applied sciences. Many people use the terms technical and engineering interchangeably. People who adopt technology in business form are called engineers. Humans have been using technology since time immemorial. Technology has a huge contribution in the development of modern civilization. Societies or nations that are technically competent are also able to be strategic and they can also become financially competent. In such a situation, it should be no surprise that engineering started with military engineering. After this, civil engineering emerged to solve the problems and requirements related to construction of roads, hous

Pakistan

Image
                                   Pakistan The Islamic Republic of Pakistan is an independent Islamic country located in a defensively important part of South Asia, Northwest Central Asia and West Asia. With a population of 21 crore, it is the fifth most populous country in the world. With 881,913 square kilometers (340,509 square miles), it is the 33rd largest country in the world. It is bounded on the south by a coastline of 1046 km (650 miles) which joins the Arabian Sea. Pakistan is bordered by India to the east, China to the northeast and Afghanistan and Iran to the west. A narrow Wakhan corridor separates Pakistan from Tajikistan in the north, while the country's maritime borders also coincide with those of Oman. The areas of present-day Pakistan were among the oldest in the world in which Mohenjo-daro and Indus Civilization Mehrgarh Taxila had ancient civilizations such as the ancient Sanskrit period and other archaeological sites under study. The region has also been ruled

Introduction to c++

Image
                Introduction to c++ C language was invented in 1972 by Dennis Ritchie as a system programming language prominently at Bell Telephone Laboratories. System programming language refers to a language used in writing operating systems. Ritchie's main objective behind inventing C was to provide a programming language that is easy to compile, that is allowed to access memory in a better way, that gives better code, and that has a lot of run-time support Do not need While designing a high level language like C was done like a low level language, on the other hand it also gave a big boost to platform independent programming.                                          C proved so useful and flexible in 1973 that Ritchie and Ken Thompson rewrote a large part of the UNIX operating system into C language. Earlier operating systems were written in assembly language. The tremendous portability capability of C, apart from Assembly, which binds a program to a single CPU, allowed UNIX