This is my personal collection of daily lessons, professional insights, and programming experiences. It’s a space where I document what I learn, and you can explore and learn from my journey too.
Tuesday, September 13, 2022
Update particular item's value from a list of data class Kotlin
Your data class should have mutable properties so that they can be changed:
fun <T> updateWorkerData(id: Int, property: KMutableProperty1<Worker, T>, value: T) { val workers = getListOfWorker() workers.forEach { if (it.id == id) { property.set(it, value) } } } updateWorkerData(1, Worker::age, 28)
Wednesday, May 25, 2022
Git Commands (Clone a specific Git branch)
git clone -b <your branch> <remote_repo url>
Example:
git clone -b myBranch https://github.com/shadhin/java.git
Monday, April 4, 2022
প্রোগ্রামিং শিখার কিছু অসাধারন ওয়েবসাইট
- http://www.learnconline.com/
- http://www.linuxtopia.org/
- http://www.happycodings.com/
- http://www.example-code.com/C/
- http://www.kodejava.org/
- http://www.sourcecodester.com/cpp
- http://www2.its.strath.ac.uk/courses/c/
- http://www.iu.hio.no/~mark/CTutorial/CTutorial.html
- http://www.mycplus.com/category/tutorials/c-programming-tutorials/
- http://www.codeproject.com/
- http://www.sourcecodesworld.com/?ai=2
- http://www.dreamincode.net/forums/forum/15-c-and-c/
- http://www.freecodemomma.com/links.php?cid=8
- http://www.cplusplus.com/
- http://code.google.com/edu/
http://projecteuler.net/ এখানে অনেক মজার সমস্যা আছে যেগুলোর বেশিরভাগই প্রোগ্রাম লিখে সমাধান করতে হয়। এখানে প্রোগ্রাম জমা দেওয়া লাগে না, কেবল প্রোগ্রাম দিয়ে বের করা উত্তরটা জমা দিতে হয়।
http://www.spoj.pl/ এখানেও অনেক ভালো সমস্যা আছে। সমাধান করে প্রোগ্রাম জমা দিলে প্রোগ্রাম সঠিক হয়েছে কি না তা জানা যায়। এই ওয়েবসাইটের একটি বৈশিষ্ট্য হচ্ছে সি, সি প্লাস প্লাস, জাভা, পার্ল, পাইথন, রুবি, পিএইচপি ইত্যাদি ব্যবহার করে প্রোগ্রাম লেখা যায়।
http://uva.onlinejudge.org/ এই সাইটে নিয়মিত অনলাইন প্রোগ্রামিং প্রতিযোগিতার আয়োজন করা হয়। এ ছাড়াও অনুশীলনের জন্য প্রচুর সমস্যা দেওয়া আছে। নতুন প্রোগ্রামারদের জন্য এটি বেশ ভালো জায়গা।
http://ace.delos.com/usacogate এটি যদিও আমেরিকার ইনফরমেটিক্স অলিম্পিয়াড ট্রেনিং প্রোগ্রাম, কিন্তু সাইটে যেকোনো দেশের প্রোগ্রামাররাই রেজিস্ট্রেশন করে অনুশীলন করতে পারে। তোমরা যারা প্রোগ্রামিং প্রতিযোগিতায় ভালো করতে চাও, তাদের অবশ্যই এখানে অনুশীলন করা উচিত।
http://www.topcoder.com/tc এখানেও নিয়মিত অনলাইন প্রোগ্রামিং প্রতিযোগিতা অনুষ্ঠিত হয়। এখানে ভালো ফলাফল করলে আবার টাকাও দেয় (কী আনন্দ!)।
এ ছাড়া এখানে অনেক ভালো টিউটোরিয়াল ও আর্টিকেল আছে। এটি অভিজ্ঞ প্রোগ্রামারদের জন্য বেশ ভালো একটি সাইট।
http://codeforces.com এই সাইটে নিয়মিত বিভিন্ন ধরনের প্রোগ্রামিং কন্টেস্ট হয়। অভিজ্ঞ প্রোগ্রামারদের জন্য ভালো।
http://www.codechef.com এটিও প্রোগ্রামিং প্রতিযোগিতার জন্য একটি ভালো ওয়েবসাইট এবং অভিজ্ঞ প্রোগ্রামারদের জন্য।
http://ioinformatics.org আন্তর্জাতিক ইনফরমেটিক্স অলিম্পিয়াডের অফিসিয়াল ওয়েবসাইট।
http://cm.baylor.edu/welcome.icpc এসিএম আইসিপিসির অফিসিয়াল ওয়েবসাইট।
Creating a bootable macOS installer errors ( dyld: Library not loaded: @executable_path/../Frameworks/IAESD.framework Versions/A/IAESD’ )
If you face this type of error when booting your Pendrive the reason is that your installed mac os is old so try to boot your USB Pendrive from a newer macOS if possible. it will work fine
sudo /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume
dyld: Library not loaded: @executable_path/../Frameworks/IAESD.framework/Versions/A/IAESD
Referenced from: /Applications/Install macOS Big Sur.app/Contents/Resources/createinstallmedia
Reason: no suitable image found. Did find:
/Applications/Install macOS Big Sur.app/Contents/Resources/../Frameworks/IAESD.framework/Versions/A/IAESD: mmap() error 1 at address=0x1021F8000, size=0x00008000 segment=__TEXT in Segment::map() mapping /Applications/Install macOS Big Sur.app/Contents/Resources/../Frameworks/IAESD.framework/Versions/A/IAESD
/Applications/Install macOS Big Sur.app/Contents/Resources/../Frameworks/IAESD.framework/Versions/A/IAESD: mmap() error 1 at address=0x102211000, size=0x00008000 segment=__TEXT in Segment::map() mapping /Applications/Install macOS Big Sur.app/Contents/Resources/../Frameworks/IAESD.framework/Versions/A/IAESD
Monday, March 28, 2022
Image processing with Matlab : Popular Command & Instruction
Basic image processing functions:
The 'imread()' command will read an image into a matrix: example : img = imread(abc.jpg);

- Size of an Image : size()

example: size(img) It's a 340x650 matrix with 3 RGB channels. 

- Display an image: imshow()
To show our image, we will use imshow() command.example : imshow(img) - Export an Image : imwrite()
imwrite(img,'s.png','png'); 
- Clear the 'command window' in MATLAB? : clc
We can clear our MATLAB's 'command window' by using this command- imaqhwinfo()
This will return the information about all the adaptors available on the system.
- vid = videoinput ('winvideo',1);
- preview (vid)
Suppose you want to preview your webcam then type

- vid=videoinput('winvideo',1);
- I=getsnapshot(vid);
- save data
Take photos from your webcam - vid=videoinput('winvideo',1);
- for i=1:10
I=getsnapshot(vid);
Fname=['Image',num2str(i),'.jpg'];
imwrite (I,Fname,'jpg');
pause(1);
endTake 10 photos from the webcam and rename them in your formate
- Create a function in Matlab
function [ output_args ] = functionName( input_args )
imshow(input_args);
end
- Automatic alignment of code lines in editor, do EDIT->Select ALL, then TEXT -> Smart INDENT
- Create Own Photo (Binary)
col=256;row=256;img=zeros(row,col);img(100:100,:)=1.5;img(:,100:100)=1.5;imshow(img);

- Crop an Image
a=imread('abc.jpg');

- imaqhwinfo()
- vid = videoinput ('winvideo',1);
- preview (vid)

- vid=videoinput('winvideo',1);
- I=getsnapshot(vid);
- save data
- vid=videoinput('winvideo',1);
- for i=1:10
Fname=['Image',num2str(i),'.jpg'];
imwrite (I,Fname,'jpg');
pause(1);
end

- Create a function in Matlab
imshow(input_args);
end
- Automatic alignment of code lines in editor, do EDIT->Select ALL, then TEXT -> Smart INDENT
- Create Own Photo (Binary)

- Crop an Image
Sunday, March 27, 2022
Thursday, March 24, 2022
Wednesday, March 23, 2022
♦ নিয়ে নিন কিছু বাংলা ওয়েবএড্রেস ।
প্রোগ্রামিং শিখার কিছু ওয়েবসাইট
- http://www.cprogrammingexpert.com/
- http://www.cprogramming.com/
- http://www.mycplus.com/category/tutorials/c-programming-tutorials/
- http://www.eskimo.com/~scs/cclass/notes/top.html
- http://www.tutorialspoint.com/ansi_c/c_introduction.htm
- http://www.cs.cf.ac.uk/Dave/C/CE.html
- http://www.programmingsimplified.com/c-program-examples
- http://einstein.drexel.edu/courses/Comp_Phys/General/C_basics/
- http://www.learnconline.com/
- http://www.linuxtopia.org/
- http://www.happycodings.com/
- http://www.example-code.com/C/
- http://www.kodejava.org/
- http://www.sourcecodester.com/cpp
- http://www2.its.strath.ac.uk/courses/c/
- http://www.iu.hio.no/~mark/CTutorial/CTutorial.html
- http://www.mycplus.com/category/tutorials/c-programming-tutorials/
- http://www.codeproject.com/
- http://www.sourcecodesworld.com/?ai=2
- http://www.dreamincode.net/forums/forum/15-c-and-c/
- http://www.freecodemomma.com/links.php?cid=8
- http://www.cplusplus.com/
- http://code.google.com/edu/
http://projecteuler.net/ এখানে অনেক মজার সমস্যা আছে যেগুলোর বেশিরভাগই প্রোগ্রাম লিখে সমাধান করতে হয়। এখানে প্রোগ্রাম জমা দেওয়া লাগে না, কেবল প্রোগ্রাম দিয়ে বের করা উত্তরটা জমা দিতে হয়।
http://www.spoj.pl/ এখানেও অনেক ভালো সমস্যা আছে। সমাধান করে প্রোগ্রাম জমা দিলে প্রোগ্রাম সঠিক হয়েছে কি না তা জানা যায়। এই ওয়েবসাইটের একটি বৈশিষ্ট্য হচ্ছে সি, সি প্লাস প্লাস, জাভা, পার্ল, পাইথন, রুবি, পিএইচপি ইত্যাদি ব্যবহার করে প্রোগ্রাম লেখা যায়।
http://uva.onlinejudge.org/ এই সাইটে নিয়মিত অনলাইন প্রোগ্রামিং প্রতিযোগিতার আয়োজন করা হয়। এ ছাড়াও অনুশীলনের জন্য প্রচুর সমস্যা দেওয়া আছে। নতুন প্রোগ্রামারদের জন্য এটি বেশ ভালো জায়গা।
http://ace.delos.com/usacogate এটি যদিও আমেরিকার ইনফরমেটিক্স অলিম্পিয়াড ট্রেনিং প্রোগ্রাম, কিন্তু সাইটে যেকোনো দেশের প্রোগ্রামাররাই রেজিস্ট্রেশন করে অনুশীলন করতে পারে। তোমরা যারা প্রোগ্রামিং প্রতিযোগিতায় ভালো করতে চাও, তাদের অবশ্যই এখানে অনুশীলন করা উচিত।
http://www.topcoder.com/tc এখানেও নিয়মিত অনলাইন প্রোগ্রামিং প্রতিযোগিতা অনুষ্ঠিত হয়। এখানে ভালো ফলাফল করলে আবার টাকাও দেয় (কী আনন্দ!)।
এ ছাড়া এখানে অনেক ভালো টিউটোরিয়াল ও আর্টিকেল আছে। এটি অভিজ্ঞ প্রোগ্রামারদের জন্য বেশ ভালো একটি সাইট।
http://codeforces.com এই সাইটে নিয়মিত বিভিন্ন ধরনের প্রোগ্রামিং কন্টেস্ট হয়। অভিজ্ঞ প্রোগ্রামারদের জন্য ভালো।
http://www.codechef.com এটিও প্রোগ্রামিং প্রতিযোগিতার জন্য একটি ভালো ওয়েবসাইট এবং অভিজ্ঞ প্রোগ্রামারদের জন্য।
http://ioinformatics.org আন্তর্জাতিক ইনফরমেটিক্স অলিম্পিয়াডের অফিসিয়াল ওয়েবসাইট।
http://cm.baylor.edu/welcome.icpc এসিএম আইসিপিসির অফিসিয়াল ওয়েবসাইট।
Database Project Using Oracle + java
- Software Management
- Advising
- Airline_database_system
- Blood_bank_demo
- Cricket Tournament Management
- e-commerce_project
- EmployeeManagementSystemDatabase
- Hospital
Different Type of Website Error Code meaning
কোনটার কী মানে, তা জেনে নিন—
- 502 Bad Gateway : এটি দিয়ে বোঝানো হয়, নির্দিষ্ট ওই সার্ভার প্রক্সি বা গেটওয়ে হিসেবে চলছিল। ডাউন স্ট্রিমে ত্রুটিপূর্ণ সাড়া পেয়েছে।
- 413 Request Entity Too Large : ধারণক্ষমতার চেয়ে বেশি পরিমাণ অনুরোধ সার্ভারে পাঠানো হয়েছে।
- 204 No Content : সার্ভারে কোনো উপাদান (কন্টেন্ট) পাওয়া যায়নি।
- 203 Non-Authoritati ve Information (since HTTP/1.1) : সার্ভার যে তথ্য দিচ্ছে, তা অন্য কোনো সূত্র থেকে আসছে।
- 403 Forbidden : সার্ভার অনুরোধ গ্রহণ করেনি।
- 400 Bad Request : অনুরোধ যথাযথ প্রক্রিয়ায় করা হয়নি।
- 404 Not Found : বর্তমানে পাওয়া যাচ্ছে না, তবে পরে পাওয়া যেতে পারে।
- 410 Gone : বর্তমানে পাওয়া যায়নি এবং পরেও পাওয়া যাবে না।
- 408 Request Timeout : অনুরোধ করে সার্ভারের সাড়া পাওয়ার সময় অতিক্রান্ত হয়ে গেছে।
C Plus Plus Project : Criminal Investigation
Cpp Project: Criminal Investigation
#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include<string.h>
class crim_rec
{
char name[20], sex, fathr_name[20], addrs[25], offense[20], blood[5], dob[9];
int crim_code, reward;
void disp();
public:
void get();
void wtf();
void rff();
void search();
void del();
void mod();
}c;
void crim_rec::get()
{
puts("\nEnter name of criminal:");
gets(name);
puts("\nSex (m/f):");
cin>>sex;
puts("\nEnter date of birth:");
gets(dob);
puts("Enter blood group (Ap/An/Bp/Bn/ABp/ABn/Op/On:");
gets(blood);
puts("\nEnter father's name:");
gets(fathr_name);
puts("Enter address:");
gets(addrs);
puts("\nEnter crime commited:");
gets(offense);
puts("\nEnter reward on criminal:");
cin>>reward;
}
void crim_rec::disp()
{
cout<<"The record of criminal:\n";
cout<<"\nName of criminal: "<<name;
cout<<"\nsex: "<<sex;
cout<<"\nDOB: "<<dob;
cout<<"\nBlood Group: "<<blood;
cout<<"\nFather's name: "<<fathr_name;
cout<<"\nAddress: "<<addrs;
cout<<"\nCrime: "<<offense;
cout<<"\nReward: "<<reward;
}
void crim_rec::wtf()
{
ofstream ofile;
ofile.open("CBI", ios::app);
get();
ofile.write((char*)&c, sizeof(c));
ofile.close();
}
void crim_rec::rff()
{
ifstream ifile;
ifile.open("CBI");
ifile.seekg(0, ios::beg);
ifile.read((char*)&c, sizeof(c));
while(ifile)
{
disp();
ifile.read ((char*)&c, sizeof(c));
}
ifile.close();
}
void crim_rec::search()
{
char m[20];
ifstream ifile("CBI");
puts("Enter name of criminal which has to be searched");
gets(m);
ifile.seekg (0, ios::beg);
ifile.read((char*)&c, sizeof(c));
while(ifile)
{
if (strcmpi(m, name)==0)
disp();
ifile.read((char*)&c, sizeof(c));
}
ifile.close();
}
void crim_rec::del()
{
char b[20];
ifstream ifile;
ifile.open("CBI", ios::app);
ofstream ofile;
ofile.open("new", ios::app);
puts("Enter the name of the criminal whose records you want to del");
gets(b);
ifile.seekg (0, ios::beg);
ifile.read((char*)&c, sizeof(c));
while(ifile)
{
if (strcmpi(b, name))
ofile.write((char*)&c, sizeof(c));
ifile.read((char*)&c, sizeof(c));
}
ifile.close();
ofile.close();
remove ("CBI");
rename("new", "CBI");
}
void crim_rec::mod()
{
char d[20];
int p;
puts("\nEnter name of criminal whose record you want to modify\n");
gets(d);
fstream f;
f.open("CBI", ios::in|ios::out);
f.seekg(0, ios::beg);
f.read((char*)&c, sizeof(c));
int a=f.tellg();
while(! f.eof())
{
if (!strcmpi(d, name))
{
puts("\nPress 1 to change name\nPress 2 to change sex\nPress 3 to change date of birth\nPress 4 to change blood group\nPress 5 to change father's name\nPress 6 to change address\nPress 7 to change crime committed\nPress 8 to change reward on criminal\n");
cin>>p;
switch(p)
{
case 1:
gets(name);
break;
case 2:
cin>>sex;
break;
case 3:
gets(dob);
break;
case 4:
gets(blood);
break;
case 5:
gets(fathr_name);
break;
case 6:
gets(addrs);
break;
case 7:
gets(offense);
break;
case 8:
cin>>reward;
break;
}
f.seekg(a-sizeof(c), ios::beg);
f.write((char*)&c, sizeof(c));
}
f.read((char*)&c, sizeof(c));
a=f.tellg();
}
f.close();
}
void main ()
{
int ch;
char choice;
do
{
cout<<"\t Central Bureau of Investigation";
cout<<"\n ********************************************";
cout<<"\n\n 1. View criminal details ";
cout<<"\n\n 2. Add new criminal details ";
cout<<"\n\n 3. Search a criminal record ";
cout<<"\n\n 4. Delete a criminal record ";
cout<<"\n\n 5. Modify a criminal record ";
cout<<"\n ********************************************";
cout<<"\n\n Enter your choice: ";
cin>>ch;
switch(ch)
{
case 1:
c.rff();
break;
case 2:
c.wtf();
break;
case 3:
c.search();
break;
case 4:
c.del();
break;
case 5:
c.mod();
break;
default:
{
cout<<"\nerror!";
}
break;
}
cout<<"\ncontinue? (y/n)\n";
cin>>choice;
}while(choice=='y');
cout<<"\nGood bye\n\n\n";
}
C Plus Plus Project : Library Manegement
Cpp Project: Library Management
#include<iostream>
#include<fstream>
#include<stdlib.h>
#include<string>
using namespace std;
class Library
{
char name[20];
char id[20];
public:
void get_data(void)
{
cout<<"NAME :";
cin>>name;
cout<<"ID :";
cin>>id;
}
void check_student()
{
{
if(id[7]=='6'&&id[8]=='0')
cout<<"You are a student of CSE Department\n";
else if(id[7]=='3'&&id[8]=='0')
cout<<"You are a student of EEE Department\n";
else if(id[7]=='4'&&id[8]=='0')
cout<<"You are astudent of ECE Department\n";
else if(id[7]=='1'&&id[8]=='0')
cout<<"You are astudent of BBA Department\n";
else if (id[7]=='7'&&id[8]=='7')
cout<<"You are astudent of pharmacy Department\n";
else if (id[7]=='5'&&id[8]=='0')
cout<<"You are astudent of ENGLISH Department\n";
else
{
cout<<"Invalid id";
exit(0);
}
}
}
};
class CSE: public Library
{
public:
void show_CSE()
{
fstream fp;
fp.open("CSE.txt");
string in;
if(fp.is_open())
{
while(fp.good())
{
getline(fp,in);
cout<<in<<"\n";
}
}
}
};
class EEE:public CSE
{
public:
void show_EEE()
{
ifstream fp;
fp.open("EEE.txt");
string in;
if(fp.is_open())
{
while(fp.good())
{
getline(fp,in);
cout<<in<<endl;
}
}
}
};
class BBA : public Library
{
public:
void show_BBA()
{
ifstream fp;
fp.open("BBA.txt");
string in;
if(fp.is_open())
{
while(fp.good())
{
getline(fp,in);
cout<<in<<endl;
}
}
}
};
class ECE: public BBA
{
public:
void show_ECE()
{
ifstream fp;
fp.open("ECE.txt");
string in;
if(fp.is_open())
{
while(fp.good())
{
getline(fp,in);
cout<<in<<endl;
}
}
}
};
class ECO : public BBA
{
public:
void show_ECO()
{
ifstream fp;
fp.open("ECO.txt");
string in;
if(fp.is_open())
{
while(fp.good())
{
getline(fp,in);
cout<<in<<endl;
}
}
}
};
class ENGLISH: public ECO
{
public:
void show_ENG()
{
ifstream fp;
fp.open("ENG.txt");
string in;
if(fp.is_open())
{
while(fp.good())
{
getline(fp,in);
cout<<in<<endl;
}
}
}
};
class other:public ENGLISH
{
public:
void show_other()
{
ifstream fp;
fp.open("other.txt");
string in;
if(fp.is_open())
{
while(fp.good())
{
getline(fp,in);
cout<<in<<endl;
}
}
}
};
int main()
{
cout<<"\t\t\t"<<" Library Manegement\n";
cout<<"\t\t\t"<<"---------------------\n";
char n;
Library lb;
lb.get_data();
lb.check_student();
cout<<"Choose witch department of book you are searching?";
cout<<"\n\n 01. CSE";
cout<<"\n\n 02. EEE";
cout<<"\n\n 03. BBA";
cout<<"\n\n 04. ECE";
cout<<"\n\n 05. ECO";
cout<<"\n\n 06. ENGLISH";
cout<<"\n\n 07. Other book";
cout<<"\n\n";
cout<<"Please input department code :";
cin>>n;
switch (n)
{
case '1':
{
CSE c;
c.show_CSE();
break;
}
case '2' :
{
EEE e;
e.show_EEE();
break;
}
case '3':
{
BBA b;
b.show_BBA();
break;
}
case '4':
{
ECE ec;
ec.show_ECE();
break;
}
case '5':
{
ECO e;
e.show_ECO();
break;
}
case '6':
{
ENGLISH eg;
eg.show_ENG();
break;
}
case '7':
{
other o;
o.show_other();
break;
}
}
return 0;
}
C Plus Plus Project : Education Institute Management System
Cpp Project: Education Institute Management System
#include <iostream>
#include<string.h>
#include<conio.h>
#include <sstream>
#include <fstream>
char User[100],pass[100],snm[100],option,op,type,dep[30],cgpa[10],date[20],id[20],sm[2],crs[100];
using namespace std;
class person
{
public:
string Name,dob;
};
class Teacher:public person
{
public:
string CourseTaken,name,pss,dob,line;
void show(char ser[])
{
ifstream myfile("trainer.txt");
while (getline(myfile, line))
{
istringstream ss(line);
ss>>name>>pss>>dob>>CourseTaken;
if(name == ser)
{
cout<<"\nName: "<<name<<"\n"<<"Date of birth"<<dob<<"\n"<<"Course Taken by: "<<CourseTaken;
cout<<"\n";
break;
}
}
myfile.close();
}
};
class Student: public person
{
public:
string dept,id;
int semester;
void show(char User[])
{
ifstream myfile("student.txt");
string line,Name,dob,id,dep,semester,pss,cg;
while (getline(myfile, line))
{
istringstream ss(line);
ss>>Name>>pss>>dob>>id>>dep>>semester>>cg;
cout<<"\n";
if(Name == User)
{
cout<<"\nName: "<<Name<<"\n"<<"Date of birth"<<dob<<"\n"<<"ID: "<<id<<"\n"<<"dep:"<<dep<<"\nSemester"<<semester<<"\n\n";
}
}
myfile.close();
}
};
class admin:public person
{
public:
string name,dob,pss,line;
void show(char User[])
{
ifstream myfile("admin.txt");
getline(myfile,line);
{
istringstream ss(line);
ss>>name>>pss>>dob;
cout<<"\nName:"<<name<<"\n"<<"date of birth"<<dob<<"\n";
cout<<"\n";
myfile.close();
}
}
};
void Take_user_input()
{
cout<<"Enter your Name: ";
cin>>User;
cout<<"password: ";
cin>>pass;
cout<<"Enter your date of birth";
cin>>date;
if(type == 's')
{
cout<<"Enter your department: ";
cin>>dep;
cout<<"Enter your id: ";
cin>>id;
cout<<"Enter your semester";fstream myfile("student.txt");
cin>>sm;
cout<<"Enter your CGPA: ";
cin>>cgpa;
}
else if(type == 't')
{
cout<<"Enter Course taken by you";
cin>>crs;
}
}
void Update(char fname[])
{
ifstream inputFile("temp.txt");
ofstream myfile;
myfile.open (fname);
// myfile << "Writing this to a file.\n";
string line;
while (getline(inputFile, line))
{
myfile<<line;
myfile<<"\n";
}
myfile.close();
inputFile.close();
}
void Delet(char fname[])
{
ifstream inputFile(fname);
ofstream myfile;
myfile.open ("temp.txt");
// myfile << "Writing this to a file.\n";
char user_to_delet[200];
string line;
cout<<"Enter the user name to delet:";
cin>>user_to_delet;
while (getline(inputFile, line))
{
istringstream ss(line);
string name;
ss >> name;
if(user_to_delet != name)
{
myfile<<line;
myfile<<"\n";
}
}
myfile.close();
inputFile.close();
Update(fname);
}
int check(char dname[])
{
ifstream inputFile(dname);
string line;
int permition = 0;
while (getline(inputFile, line))
{
istringstream ss(line);
string name,p;
ss >> name >> p;
again:
if(User == name)
{
if(pass == p)
{
cout <<"Successfully logged in" ;
permition = 1;
}
else
{
cout<<"Wrong pass word\nEnter your password again:";
cin>>pass;
goto again;
}
break;
}
}
inputFile.close();
return permition;
}
void Creat_Account(char fname[])
{
FILE *f = fopen(fname,"a");
fputs(User,f);
putc(' ',f);
fputs(pass,f);
putc(' ',f);
fputs(date,f);
if(type == 's')
{
putc(' ',f);
fputs(dep,f);
putc(' ',f);
fputs(id,f);
putc(' ',f);
fputs(sm,f);
putc(' ',f);
fputs(cgpa,f);
}
else if(type == 't')
{
putc(' ',f);
fputs(crs,f);
}
fprintf(f,"\n");
fclose(f);
}
void Add_Courses()
{
FILE *f;
f = fopen("Courses.txt","a");
char Cname[200],trainer[200],p;
float credit;
do
{
cout<<"Enter your course name: ";
cin>>Cname;
cout<<"Enter trainer's name: ";
cin>>trainer;
cout<<"Enter course credit";
cin>>credit;
fprintf(f,"%s %s %f",Cname,trainer,credit);
fprintf(f,"\n");
cout<<"\npress:\n\n\tM: for main menu\n\tc: for add more course";
cin>>p;
} while(p!='m');
fclose(f);
}
void Show_Courses()
{
ifstream myfile("Courses.txt");
string line,cnm,tnm,crdt;
cout<<"Course Name\tTrainer's name\tcredit hour\n";
cout<<"-------------------------------------------\n";
while (getline(myfile, line))
{
istringstream ss(line);
ss>>cnm>>tnm>>crdt;
cout<<cnm<<"\t\t"<<tnm<<"\t\t"<<crdt;
cout<<"\n";
}
myfile.close();
}
int main()
{
int permition;
cout<<"Welcome to MakeITpossible:\n";
cout<<"\nPress:\n\tT: for teacher\n\ts: for Student\n\ta:for admin\n";
cin>>type;
if(type == 's')
{
cout<<"\npress:\n\t\"1:\"for login:\n\t\"2:\"for creat new account\n";
cin>>op;
if(op == '1')
{
cout<<"Enter your Name: ";
cin>>User;
cout<<"password: ";
cin>>pass;
permition = check("student.txt");
if(permition == 1)
{
do
{
cout<<"\n\nEnter:\n\n\t\"c\":to see the courses:\n\t\"p\"to see your profile\n\t\"t\"to see trainer's profile\n\t\"q\" to quit";
cin>>option;
if(option == 'c')
{
Show_Courses();
}
else if(option == 'p')
{
Student st;
st.show(User);
}
else if(option == 't')
{
cout<<"Enter the teacher's name";
cin>>snm;
Teacher t;
t.show(snm);
}
}while(option!='q');
}
}
else if(op == '2')
{
cout<<"Creat an account";
Take_user_input();
Creat_Account("student.txt");
}
}
else if(type == 'a')
{
char op;
cout<<"Welcome admin";
cout<<"\nEnter :\n\t1: to login\n\t2: creat account: ";
cin>>op;
if(op == '1')
{
cout<<"Enter your Name: ";
cin>>User;
cout<<"password: ";
cin>>pass;
permition = check("admin.txt");
if(permition == 1)
{
do
{
cout<<"\n\nEnter:\n\n\t1:to see the courses:\n\t2: to add course\n\t3:to see your profile\n\t4: to see trainer's profile\n\t5: to see a student's profile\n\t6: to delet an student from list\n\t\"q\" to quit";
cin>>option;
if(option == '1')
{
Show_Courses();
}
else if(option == '2')
{
Add_Courses();
}
else if(option == '3')
{
admin a;
a.show(User);
}
else if(option == '4')
{
cout<<"Enter name of trainer: ";
cin>>snm;
Teacher t;
t.show(snm);
}
else if (option == '5')
{
cout<<"Enter student's name to see profile:";
cin>>snm;
Student s;
s.show(snm);
}
else if (option == '6')
{
Delet("student.txt");
}
}while(option!='q');
}
}
else if(op == '2')
{
Take_user_input();
Creat_Account("admin.txt");
}
}
else if(type == 't')
{
cout<<"Welcome Trainer";
cout<<"\nEnter :\n\t1: to login\n\t2: creat account: ";
cin>>op;
if(op == '1')
{
cout<<"Enter your Name: ";
cin>>User;
cout<<"password: ";
cin>>pass;
permition = check("trainer.txt");
if(permition == 1)
{
do
{
cout<<"\n\nEnter:\n\n\t1:to see the courses:\n\t2:to see your profile\n\t3: to see a student's profile\n\t\"q\" to quit";
cin>>option;
if(option == '1')
{
Show_Courses();
}
else if(option == '2')
{
Teacher t;
t.show(User);
}
else if(option == '3')
{
cout<<"Enter student's name to see profile: ";
cin>>snm;
Student s;
s.show(snm);
}
}while(option!='q');
}
}
else
{
Take_user_input();
Creat_Account("trainer.txt");
}
}
getch();
return 0;
}
C Plus Plus Project : Hotel Management for Traveling Agency
Cpp Project: Hotel Management for Traveling Agency
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<fstream>
#include<sstream>
#include<stdio.h>
#include<string.h>
using namespace std;
#define MaxRoom 1000
class CustomerData
{
public:
string username;
int userid;
string cell;
string address;
};
class RoomData
{
public:
int roomNumber;
CustomerData C;
int rate;
bool flag;
};
class HotelData
{
public:
string HotelName;
int HotelId;
int NumberOfRoom;
int NumberOfCustomer;
RoomData Room[MaxRoom];
HotelData(string hn, int id, int n)
{
HotelName=hn;
HotelId=id;
NumberOfRoom=n;
UpdateRoomData();
}
void UpdateRoomData()
{
for(int i=0;i<NumberOfRoom;i++)
{
Room[i].roomNumber=1001+i;
Room[i].flag=false;
Room[i].rate=2000;
}
ifstream myfile;
string fileName = HotelName+".txt";
char c[fileName.size()+1];
memset(c, 0, sizeof(c));
for(int i=0;i<fileName.size();i++)
c[i]=fileName[i];
myfile.open(c);
stringstream ss;
string a,cn,ca;
int number,cid,cc,r;
CustomerData uu;
while(getline(myfile,a))
{
ss.clear();ss<<a;ss>>number;
getline(myfile,a);
cn=a;
getline(myfile,a);
ss.clear();ss<<a;ss>>cid;
getline(myfile,a);
ss.clear();ss<<a;ss>>cc;
getline(myfile,a);
ca=a;
getline(myfile,a);
ss.clear();ss<<a;ss>>r;
uu.username=cn;
uu.userid=cid;
uu.cell=cc;
uu.address=ca;
AddUser(uu,number);
}
myfile.close();
UpdateFile();
}
void AddUser(CustomerData NewUser, int num)
{
for(int i=0;i<NumberOfRoom;i++)
{
if(Room[i].roomNumber==num)
{
Room[i].C=NewUser;
Room[i].flag=true;
break;
}
}
}
void UpdateFile()
{
ofstream myfile;
string fileName = HotelName+".txt";
char c[fileName.size()+1];
memset(c, 0, sizeof(c));
for(int i=0;i<fileName.size();i++)
c[i]=fileName[i];
myfile.open(c);
for(int i=0;i<NumberOfRoom;i++)
{
if(Room[i].flag)
{
myfile<<Room[i].roomNumber<<endl;
myfile<<Room[i].C.username<<endl;
myfile<<Room[i].C.userid<<endl;
myfile<<Room[i].C.cell<<endl;
myfile<<Room[i].C.address<<endl;
myfile<<Room[i].rate<<endl;
}
}
myfile.close();
}
};
void printOptions(void)
{
cout<<"1. Show Hotel List"<<endl;
cout<<"2. Select Hotel"<<endl;
cout<<"3. Show Available Rooms"<<endl;
cout<<"4. New Customer Entry"<<endl;
cout<<"5. Remove Customer"<<endl;
cout<<"6. Exit"<<endl;
}
vector<HotelData> H;
bool hotelSelection;
int hotelId;
void preCalculate(void)
{
ifstream myfile;
myfile.open("HotelList.txt");
string a;
string name;
int id, n;
stringstream ss;
while(getline(myfile,a))
{
name=a;
getline(myfile,a);
ss.clear();
ss<<a;
ss>>id;
getline(myfile,a);
ss.clear();
ss<<a;
ss>>n;
//cout<<name<<" "<<id<<" "<<n<<endl;
HotelData th(name,id,n);
H.push_back(th);
}
myfile.close();
for(int i=0;i<H.size();i++)
H[i].UpdateFile();
}
void ShowHotelList()
{
ifstream myfile;
myfile.open("HotelList.txt");
string a;
string name;
int id, n;
stringstream ss;
while(getline(myfile,a))
{
name=a;
getline(myfile,a);
ss.clear();
ss<<a;
ss>>id;
getline(myfile,a);
ss.clear();
ss<<a;
ss>>n;
cout<<"Name: "<<name<<endl;
cout<<"HotelId: "<<id<<endl;
}
printf("\n\n");
myfile.close();
}
void SelectHotel()
{
cout<<"Enter HotelID: ";
cin>>hotelId;
hotelSelection=true;
cout<<"Hotel Selected..."<<endl;
}
string getHotelName(int id)
{
for(int i=0;i<H.size();i++)
{
if(H[i].HotelId==id)
return H[i].HotelName;
}
return "HotelName Not Found";
}
void ShowAvailAbleRooms(void)
{
cout<<"Hotel Name: "<<getHotelName(hotelId)<<endl;
for(int i=0;i<H.size();i++)
{
if(H[i].HotelId==hotelId)
{
cout<<"Available Rooms.....\n";
for(int j=0;j<H[i].NumberOfRoom;j++)
{
if(H[i].Room[j].flag==false)
cout<<H[i].Room[j].roomNumber<<endl;
}
}
}
}
void NewCustomerEntry(void)
{
string fileName = getHotelName(hotelId)+".txt";
CustomerData cc;
int roomnumber, rate;
cout<<"Enter Room Number: "; cin>>roomnumber;
cout<<"Enter Customer Name: "; cin>>cc.username;
cout<<"Enter Customer Id: "; cin>>cc.userid;
cout<<"Enter Customer Cell: "; cin>>cc.cell;
cout<<"Enter Customer Address: "; cin>>cc.address;
rate=2000;
for(int i=0;i<H.size();i++)
{
if(H[i].HotelId==hotelId)
{
H[i].AddUser(cc,roomnumber);
H[i].UpdateFile();
}
}
cout<<"Entry completed"<<endl;
}
void RemoveUser()
{
int userId;
cout<<"Enter UserId: ";
cin>>userId;
for(int i=0;i<H.size();i++)
{
if(H[i].HotelId==hotelId)
{
for(int j=0;j<H[i].NumberOfRoom;j++)
{
if(H[i].Room[j].C.userid==userId)
{
H[i].Room[j].flag=false;
H[i].UpdateFile();
cout<<"Customer Deleted Successfully"<<endl;
return;
}
}
}
}
cout<<"Cutomer Id not found"<<endl;
return;
}
int main()
{
preCalculate();
int token;
while(token>0)
{
printOptions();
cout<<"Enter Your Choice: ";
cin>>token;
system("cls");
if(token==1)
ShowHotelList();
if(token==2)
SelectHotel();
if(token==3)
{
if(hotelSelection==false)
{
cout<<"Hotel must be selected first"<<endl;
continue;
}
ShowAvailAbleRooms();
}
if(token==4)
{
if(hotelSelection==false)
{
cout<<"Hotel must be selected first"<<endl;
continue;
}
NewCustomerEntry();
}
if(token==5)
{
if(hotelSelection==false)
{
cout<<"Hotel must be selected first"<<endl;
continue;
}
RemoveUser();
}
if(token==6)
break;
cout<<"Press any key to continue....."<<endl;
getchar();
getchar();
}
return 0;
}
C Plus Plus Project : Depertmental Store Management
Cpp Project: Departmental store Management
//*******************************************************
//Depertmental store Management
//*******************************************************
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<fstream>
using namespace std;
class list
{
int id,quality,quantity,i,t,j;//count;
float price,value,p;
char product[10],keep[10],ch;
public:
void add_products();
void show(char*);
void del_product();
void search();
//void total_sold();
};
void list::add_products()
{
int n;
do
{
FILE *fp;
fp=fopen("dept.txt","a");
printf("Product id:");
scanf("%d",&id);
printf("Product name:");
scanf("%s",&product);
printf("product Price:");
scanf("%f",&price);
printf("product Quality:");
scanf("%d",&quality);
printf("product Quantity:");
scanf("%d",&quantity);
fprintf(fp,"%d \t\t %s \t\t %0.2f \t\t %d \t\t%d\n",id,product,price,quality,quantity);
fclose(fp);
system("cls");
cout<<"to add another products press 0and to stop press 1 !";
cin>>n;
}
while(n!=0);
//count++;
}
void list::show(char m[20])
{
cout<<"id \t\t name\t \t price \t \t quality\t\tquantity"<<endl;
fstream fp;
fp.open(m,ios::in);
while(fp)
{
fp.get(ch);
cout<<ch;
}
}
//void list::total_sold()
// {
// cout<<"Total sold products :"<<count<<endl;
//}
void list:: del_product()
{
FILE *fp;
int line_num = 1;
int search_result = 0;
char temp[5000];
char *e;
char fname[10],del[100],m[5000];
int d,i,j=0,n=0;
printf("Enter your file name and delete part\n");
scanf("%s %s",fname,del);
for(d=0; del[d]!='\0'; d++)
{
}
e=fname;
fp=fopen(e,"r");
while(fgets(temp, 5000, fp) != NULL)
{
if((strstr(temp, del)) != NULL)
{
}
else
{
for(i=0; temp[i]!='\0'; i++)
{
m[j]=temp[i];
j++;
}
}
}
fclose(fp);
fp=fopen(e,"w");
for(n=0; n<j; n++)
{
if(m[n]==1)
{
fprintf(fp,"\n");
}
else
{
fprintf(fp,"%c",m[n]);
}
}
fclose(fp);
}
void list::search()
{
FILE *fp;
char fname[10],search[100],temp[5000];
char *e;
int m=0,n;
printf("Enter your file name\n");
scanf("%s",fname);
e=fname;
fp=fopen(e,"r");
while(1)
{
n=0;
printf("Enter your search string\n");
scanf("%s",search);
while(fgets(temp, 5000,fp)!=NULL)
{
if(strstr(temp,search)!=NULL)
{
printf("%s\n",temp);
n++;
}
}
if(n==0)
{
printf("Does not match :- %s\n",search);
}
printf("If you want to continue press 0 and stop press 1\n");
scanf("%d",&m);
if(m==1)
{
break;
}
}
}
int main()
{
list ob;
int x;
char m[20]="dept.txt";
// system("color 3");
do{
cout<<"\n******************************************************************";
cout<<"\n" "\t""EAST WEST UNIVERSITY";
cout<<"\n******************************************************************";
cout<<"\n\nMAKE YOUR CHOICE:\n";
cout<<"\n1. FOR ADD PRODUCTS:";
cout<<"\n2. FOR SEE PRODUCTS:";
cout<<"\n3. DELETE PRODUCTS:";
cout<<"\n4. SEARCH PRODUCTS:";
// cout<<"\n5. TOTAL SOLD PRODUCTS:";
cout<<"\n5. QUIT\n";
cin>>x;
switch(x)
{
case 1:ob.add_products();
break;
case 2: ob.show(m);
break;
case 3: ob.del_product();
break;
case 4: ob.search();
break;
// case 5:ob.total_sold();
// break;
case 5: break;
}
}
while(x!=5);
return 0;
}



.jpeg)


.jpeg)
.jpeg)

.jpeg)
