c tutorial

C++ Project – Parking Lot Management System 0

C++ Project – Parking Lot Management System

Program 1 //Parking Lot Management System #include <iostream> using namespace std; class ParkingLot { private: int twoWheelerCount; int fourWheelerCount; const int maxTwoWheelers; const int maxFourWheelers; public: // Constructor to initialize ParkingLot(int max2W, int max4W)...

C++ Exception Handling 0

C++ Exception Handling

Program 1 #include <iostream> using namespace std; int main() { system(“cls”); int a,b,c; cout<<“Enter two number for division: “<<endl; cin>>a>>b; try { if(b==0) throw(“can not divide by zero…..”); c=a/b; cout<<“Ans of (a/b) is :...

How to Open and Close a File in C++ 0

How to Open and Close a File in C++

Program 1 // open file using Open Method for read #include <iostream> #include <fstream> #include <string> using namespace std; int main() { fstream fout; system(“cls”); fout.open(“H://dataflair//studentname.txt”,ios::app); //open a file in write mode) fout<<“Vishal Verma”;...

Destructors in C++ 0

Destructors in C++

Program 1 // Destructor in C++ #include<iostream> #include<conio.h> using namespace std; class Test { int a,b; public: Test(int a,int b) //constructor { this->a=a; this->b=b; cout<<“\nI am constructor\n”; } void maxData() { if(a>b) cout<<“\nFirst no...

Dynamic Memory Allocation in C++ Part – 3 0

Dynamic Memory Allocation in C++ Part – 3

Program 1 // Dynamic memory in CPP #include <iostream> #include <cstring> // for strcpy using namespace std; class Student { private: char* name; int* marks; int numSubjects; public: // Constructor Student(const char* studentName, int...