Pages

Monday, March 28, 2022

Image processing with Matlab : Popular Command & Instruction

 Basic image processing functions:  

  • Read an Image : imread() 
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);
     end
Take 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');
i=imcrop(a);
imshow(i)
  • rotate an image in Matlab and Subplot
a= imread ('abc.jpg');
i = imrotate(a,180,'bilinear');
i2 = imrotate(a,45,'nearest');
subplot(2,1,1)
imshow(i)
subplot(2,1,2)
imshow(i2)

Wednesday, March 23, 2022

♦ নিয়ে নিন কিছু বাংলা ওয়েবএড্রেস ।

আজ আমি আপানদের সাথে জনপ্রিয় কিছু বাংলা ওয়েব এড্রেস শেয়ার করলাম । যা হয়তো অনেকেই জানেনা। তাদের জন্য আমার এই পোস্ট । টেকটিউনস এর মত এই সাইট গুলো।

প্রোগ্রামিং শিখার কিছু ওয়েবসাইট

প্রোগ্রামিং শিখার ক্ষেতে সি প্রোগ্রামিং ১টি অনন্য প্রোগ্রামিং ল্যংগুএজ। আমাদের অনেকরই ইন্টারনেট এ পড়ার অভিজ্ঞতা আছে। আপনাদের জন্যই আজ নিয়ে  এলাম সি প্রোগ্রামিং শিখার কিছু অসাধারন লিংক । আশা করি আপনাদের কাজে লাগবে।
  1. http://www.cprogrammingexpert.com/
  2. http://www.cprogramming.com/
  3. http://www.mycplus.com/category/tutorials/c-programming-tutorials/
  4. http://www.eskimo.com/~scs/cclass/notes/top.html
  5. http://www.tutorialspoint.com/ansi_c/c_introduction.htm
  6. http://www.cs.cf.ac.uk/Dave/C/CE.html
  7. http://www.programmingsimplified.com/c-program-examples
  8. http://einstein.drexel.edu/courses/Comp_Phys/General/C_basics/
  9. http://www.learnconline.com/
  10. http://www.linuxtopia.org/
  11. http://www.happycodings.com/
  12. http://www.example-code.com/C/
  13. http://www.kodejava.org/
  14. http://www.sourcecodester.com/cpp
  15. http://www2.its.strath.ac.uk/courses/c/
  16. http://www.iu.hio.no/~mark/CTutorial/CTutorial.html
  17. http://www.mycplus.com/category/tutorials/c-programming-tutorials/
  18. http://www.codeproject.com/
  19. http://www.sourcecodesworld.com/?ai=2
  20. http://www.dreamincode.net/forums/forum/15-c-and-c/
  21. http://www.freecodemomma.com/links.php?cid=8
  22. http://www.cplusplus.com/
  23. http://code.google.com/edu/

বাংলায় কয়েকটি প্রোগ্রামিং টিউটোরিয়াল সাইট দিলাম। বিশেষ করে  cpbook.subeen.com সাইটটি নতুনদের জন্য,এমনকি স্কুলছাত্রদের জন্যও খুব ভালো হবে ।
প্রোগ্রামিং প্রতিযোগিতার জন্য কিছু লিংক:

    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

                                              Database Project Using Oracle + java
  1. Software Management 
  2. Advising 
  3. Airline_database_system 
  4. Blood_bank_demo 
  5. Cricket Tournament Management 
  6. e-commerce_project 
  7. EmployeeManagementSystemDatabase 
  8. Hospital 

Different Type of Website Error Code meaning

ইন্টারনেটে অনেক সময় বিভিন্ন ওয়েবসাইট দেখতে গেলে বিভিন্ন বার্তা পাওয়া যায়। যেমন:502 Bad Gateway, 404 Not Found,403 Forbidden, 400 Bad Request, 4xxClient Error, continue, 408 Request Timeout, 415 Unsupported Media Type, 450 Blocked by Windows Parental Controls, 500 Internal Server Error ইত্যাদি। 

কোনটার কী মানে, তা জেনে নিন— 
  • 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 : অনুরোধ করে সার্ভারের সাড়া পাওয়ার সময় অতিক্রান্ত হয়ে গেছে।

সফটওয়্যার ডাউনলোড করার কিছু সাইট

আজ আপনাদের জন্য আনলাম সফটওয়্যার ডাউনলোড করার সাইট।
  1. www.filehippo.com 
  2. www.soft32.com

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;  
   }  


C Plus Plus Project : AddressBook

Cpp project: AddressBook

 #include<fstream>  
 #include<iostream>  
 #include<conio.h>  
 #include<ctype.h>  
 #include<stdio.h>  
 #include<string.h>  
 #include<stdlib.h>  
 using namespace std;  
 void welcome();  
 void ba_bye();  
 void ba_bye()  
 {  
   puts("Thank you for using address book :) ");  
   getch();  
 }  
 void welcome()  
 {  
   puts("**************** W E L C O M E *********************** ");  
   puts("******************** T O ****************************** " );  
   puts("******** A D D R E S S B O O K P R O J E C T ******** ");  
   puts("\n");  
   puts(" \t*** PRESS ANY KEY TO CONTINUE***");  
   getch();  
   return;  
 }  
 class decVarFunc // declaring functions and variables name  
 {  
 public:  
   //variable list  
   int record;  
   long pn1; // house phone number  
   char pn2[10]; //office phone number  
   char address1[50]; // house  
   char address2[50]; // office  
   char occupation[20];  
   char name[20];  
   char emailadd[25];  
   char webadd[25];  
   //function list  
   void updateRec(); //modifying data  
   void addNew(); //adding new record  
   void deleteRec(); // delete records  
   void menu();  
   void search(); // searching records  
   void view1(); // searched result  
   void input(); // entering details  
   void view(); //displaying all records  
   char check(char *); // surity about update records  
   int recNo(); // number of records  
 } obj;  
 void decVarFunc::addNew()  
 {  
   ofstream fout;  
   //out :: open a file for output  
   //app :: open a file for output and write all data  
   fout.open("eka",ios::out|ios::app);  
   input();  
   fout.write((char*)&obj,sizeof(obj));  
   fout.close();  
 }  
 int decVarFunc::recNo()  
 {  
   ifstream fin;  
   fin.open("eka");  
   //end :: Set the file pointer at the end of the file.  
   fin.seekg(0,ios::end);  
   int n;  
   n=fin.tellg()/sizeof(obj);  
   cout<<" \n NUMBER OF RECORDS = "<<n ;  
   return n ;  
 }  
 void decVarFunc::search()  
 {  
   ifstream fin;  
   fin.open("eka");  
   if(fin.fail())  
   {  
     cout<<" \n FILE NOT FOUND!!! ";  
     getch();  
     return;  
   }  
   printf("\n\nS E A R C H I N G\n\n");  
   cout<<" \n ENTER PHONE NUMBER TO SEARCH : ";  
   long pn;  
   cin>>pn;  
   int n;  
   n=recNo();  
   for(int i=0; i<n; i++)  
   {  
     fin.read((char*)&obj,sizeof(obj));  
     if(pn==pn1)  
     {  
       view1();  
       return;  
     }  
     else  
     {  
       cout<<"\n\nSORRY!! RECORD NOT FOUND\n\n";  
     }  
   }  
   if(fin.eof())  
   {  
     cout<<" \n RECORD NOT FOUND\n ";  
   }  
 }  
 void decVarFunc::input()  
 {  
   char ch;  
   printf("A D D I T I O N");  
   cout<<" \n ENTER HOUSE PHONE NUMBER : ";  
   cin>>pn1;  
   cout<<" \n ENTER OFFICE PHONE NUMBER : ";  
   cin>>pn2;  
   // ch=cin.get();  
   cin.get(ch);  
   cout<<" \n ENTER NAME : ";  
   gets(name);  
   cout<<" \n ENTER THE OCCUPATION : ";  
   gets(occupation);  
   cout<<" \n ENTER HOUSE ADDRESS : ";  
   gets(address1);  
   cout<<" \n ENTER OFFICE ADDRESS : ";  
   gets(address2);  
   cout<<" \n ENTER EMAIL ADDRESS : ";  
   gets(emailadd);  
   cout<<" \n ENTER INTERNET ADDRESS : ";  
   gets(webadd);  
 }  
 void decVarFunc::view1()  
 {  
   cout<<"\n";  
   cout<<" HOUSE PHONE NUMBER : "<<obj.pn1<<"\n";  
   cout<<" OFFICE PHONE NUMBER2 : "<<obj.pn2<<"\n";  
   cout<<" NAME : "<<obj.name<<"\n";  
   cout<<" HOUSE ADDRESS : "<<obj.address1<<"\n";  
   cout<<" OCCUPATION : "<<obj.occupation<<"\n";  
   cout<<" OFFICE ADDRESS : "<<obj.address2<<"\n";  
   cout<<" EMAIL ADDRESS : "<<obj.emailadd<<"\n";  
   cout<<" INTERNET ADDRESS : "<<obj.webadd<<"\n";  
   getch();  
 }  
 void decVarFunc::updateRec()  
 {  
   printf("M O D I F I C A T I O N");  
   long pn;  
   int n,i;  
   ifstream fin;  
   ofstream fout;  
   fin.open("eka");  
   if(fin.fail())  
   {  
     cout<<"\n FILE NOT FOUND !";  
     fout.close();  
     exit(-1);  
   }  
   fout.open("new");  
   n=recNo();  
   if(n==0)  
   {  
     cout<<"\n FILE IS EMPTY ! ";  
     getch();  
     return;  
   }  
   while(fin.good())  
   {  
     fin.read((char*)&obj,sizeof(obj));  
     fout.write((char*)&obj,sizeof(obj));  
   }  
   fin.close();  
   fout.close();  
   fout.open("eka",ios::trunc);  
   fin.open("new");  
   if(fin.fail())  
   {  
     cout<<"\n FILE NOT FOUND !";  
     exit(-1);  
   }  
   char ch;  
   cout<<"\n ENTER PHONE NUMBER :";  
   cin>>pn;  
   ch=cin.get();  
   for(i=0; i<n; i++)  
   {  
     fin.read((char*)&obj,sizeof(obj));  
     char d;  
     if(pn==pn1)  
     {  
       //view1();  
       d=check("HOUSE PHONE NUMBER ");  
       if((d=='y') || (d=='Y'))  
       {  
         cout<<"\n ENTER NEW PHONE NUMBER :";  
         cin>>pn1;  
         ch=cin.get();  
       }  
       if(check("OFFICE PHONE NUMBER ")=='Y')  
       {  
         cout<<"\n ENTER NEW PHONE NUMBER :";  
         cin>>pn2;  
         ch=cin.get();  
       }  
       if(check("NAME")=='y')  
       {  
         cout<<"\n ENTER NEW NAME : ";  
         gets(name);  
       }  
       if(check("HOME ADDRESS")=='y')  
       {  
         cout<<"\n ENTER NEW ADDRESS :";  
         gets(address1);  
       }  
       if(check("OFFICE ADDRESS")=='y')  
       {  
         cout<<"\n ENTER NEW ADDRESS :";  
         gets(address2);  
       }  
       if(check("EMAIL ADDRESS:")=='y')  
       {  
         cout<<"\n ENTER NEW MAIL ADDRESS :";  
         gets(emailadd);  
       }  
       if(check("INTERNET ADDRESS")=='y')  
       {  
         cout<<"\n ENTER NEW INTERNET ADDRESS :";  
         gets(webadd);  
       }  
     }  
     fout.write((char*)&obj,sizeof(obj));  
   }  
   fout.close();  
   fin.close();  
 }  
 char decVarFunc::check(char *s)  
 {  
   cout<<"\n MODIFY \t "<<s<<"\t"<<"Y/N";  
   char ch;  
   ch =getch();  
   //cin.get(ch);  
   if((ch=='y')||(ch=='Y'))  
     return 'y';  
   else  
     return 'n';  
 }  
 void decVarFunc::deleteRec()  
 {  
   printf("D E L E T I O N \n");  
   long pn;  
   int n,i;  
   ifstream fin;  
   ofstream fout;  
   fin.open("eka");  
   if(fin.fail())  
   {  
     cout<<"\n FILE NOT FOUND ! ";  
     getch();  
     return;  
   }  
   fout.open("new");  
   n=recNo();  
   if(n==0)  
   {  
     cout<<"\n FILE IS EMPTY ! ";  
     getch();  
     return;  
   }  
   for(i=0; i<n; i++)  
   {  
     fin.read((char*)&obj,sizeof(obj));  
     fout.write((char*)&obj,sizeof(obj));  
   }  
   fin.close();  
   fout.close();  
   fout.open("eka",ios::trunc);  
   fin.open("new");  
   if(fin.fail())  
   {  
     cout<<"\n FILE NOT FOUND ! ";  
     getch();  
     return;  
   }  
   cout<<"\n ENTER PHONE NUMBER :";  
   cin>>pn;  
   for(i=0; i<n; i++)  
   {  
     fin.read((char*)&obj,sizeof(obj));  
     if(pn!=pn1){  
       fout.write((char*)&obj,sizeof(obj));  
       cout<<"\nDELETED!!!\n";}  
   }  
   fout.close();  
   fin.close();  
 }  
 void decVarFunc::view()  
 {  
   ifstream fin;  
   int n,j;  
   fin.open("eka");  
   if(fin.fail()||fin.bad())  
   {  
     cout<<"\n FILE NOT FOUND ! ";  
     getch();  
     return;  
   }  
   int i=0;  
   n=recNo();  
   for(j=0; j<n; j++)  
   {  
     cout<<"\n RECORD "<<i+1<<"\n";  
     fin.read((char*)&obj,sizeof(obj));  
     cout<<"\n PHONE NUMBER1 :"<<obj.pn1<<"\n";  
     cout<<"\n PHONE NUMBER2 :"<<obj.pn2<<"\n";  
     cout<<"\n NAME :"<<obj.name<<"\n";  
     cout<<"\n HOUSE ADDRESS :"<<obj.address1<<"\n";  
     cout<<"\n OCCUPATION :"<<obj.occupation<<"\n";  
     cout<<"\n OFFICE ADDRESS :"<<obj.address2<<"\n";  
     cout<<"\n INTERNET ADDRESS :"<<obj.webadd<<"\n";  
     cout<<"\n EMAIL ADDRESS : "<<obj.emailadd<<"\n";  
     i+=1;  
   }  
   fin.close();  
   getch();  
 }  
 void decVarFunc::menu()  
 {  
   char ch;  
   printf(" \n\nMAIN MENU\n");  
   printf(" \tA:ADD\n");  
   printf(" \tD:DELETE\n");  
   printf(" \tU:UPDATE\n");  
   printf(" \tV:VIEW\n");  
   printf(" \tS:SEARCH\n");  
   printf(" \tE:EXIT\n");  
   ch=getch();  
   switch(ch)  
   {  
   case 'a':  
   case 'A':  
     addNew();  
     break;  
   case 'd' :  
   case 'D' :  
     deleteRec();  
     break;  
   case 'u':  
   case 'U':  
     updateRec();  
     break;  
   case 'v':  
   case 'V':  
     view();  
     break;  
   case 's':  
   case 'S':  
     search();  
     break;  
   case 'e':  
   case 'E':  
     ba_bye();  
     system("cls");  
     exit(0);  
   }  
 }  
 int main()  
 {  
   welcome();  
   for(;;)  
   {  
     obj.menu();  
   }  
   return 0;  
 }  



C Plus Plus Project : Salary

Cpp Project: Salary

 #include<iostream>  
 #include<string.h>  
 #include<stdlib.h>  
 #include<stdio.h>  
 #include<conio.h>  
 #include<fstream>  
 using namespace std;  
 class salary  
 {  
    float a;  
    fstream file;  
    char ch;  
 public:  
   char t;  
   void show(int);  
   void final(char m[20]);  
 };  
 void salary ::final(char m[20])  
   {  
   file.open(m,ios::in);  
   if(!file)  
    {  
    cout<<"invalid name.";  
    }  
   else  
   {  
    (file)  
     ;{  
     file.get(ch);  
     cout<<ch;  
     }  
   }  
   }  
 void salary ::show(int a)  
   {  
   if(a==1)  
   cout<<"\n\nThe person gets 1000 to 2000$ are \n\tOpu\n\tSahin\n\nto show their information enter name::\n";  
   if(a==2)  
   cout<<"\n\nThe person gets 2000 to 3000$ are \n\tomor\n\Wasif\n\nto show their information enter name::\n";  
   if(a==3)  
   cout<<"\n\nThe person gets 3000 to 4000$ are \n\tkabir\n\tmasud\nto show thrir information enter name::\n";  
   }  
 class sal_1:public salary  
 {  
  public:  
 };  
 class sal_2:public salary  
 {  
   public:  
 };  
 class sal_3:public salary  
 {  
   public:  
 };  
 int main()  
 {  
    int a;  
    char m[20];  
    while(1)  
    {  
    cout<<"\nif you want to exit press 0\n\nsalary starts 1000$ to 4000$\n\n enter you salary::";  
    cin>>a;  
   if(a>=1000 && a<=1999)  
    {  
     cout<<"\nyour salary lies between 1000 to 2000$";  
     sal_1 s1;  
     s1.show(1);  
     cin>>m;  
     strcat(m,".txt");  
     s1.final(m);  
      getch();  
    }  
    else if(a>=2000 && a<=2999)  
    {  
     cout<<"\nyour salary lies between 2000 to 3000$";  
     sal_2 s2;  
     s2.show(2);  
     cin>>m;  
     strcat(m,".txt");  
     s2.final(m);  
     getch();  
    }  
    else if(a>=3000 && a<=4000)  
    {  
     cout<<"\nyour salary lies between 3000 to 4000$";  
     sal_3 s3;  
     s3.show(3);  
     cin>>m;  
     strcat(m,".txt");  
     s3.final(m);  
     getch();  
    }  
    else if(a==0)  
    break;  
    else if(a>>4001 && a<<999)  
    {  
    cout<<"invalid ammount.";  
    getch();  
    }  
    }  
 return 0;  
 }  



C Plus Plus Project : University Cgpa calculation

Cpp Project: University Cgpa calculation

 #include<fstream>    //using file  
 #include<string.h>   //character of array  
 #include<iostream>   //C++  
 #include<stdio.h>    //c header file  
 #include<stdlib.h>   //color header file  
 using namespace std;  
 class student      //class name  
 {  
 public:  
   char name[40];  
   char roll[10];  
   char dep[5];  
   char batch[5];  
 //*****************************************  
   void get()  
   {  
     cout<<"\n  ENTER THE NAME     = ";  
     cin>>name;  
     cout<<"  ENTER THE ROLL     = ";  
     cin>>roll;  
     cout<<"  ENTER THE DEPARTMENT  = ";  
     cin>>dep;  
     cout<<"  ENTER THE BATCH     = ";  
     cin>>batch;  
   }                       // back 118  
 };  
 //*****************************************  
 class cgpa:public student        // INHERITANCE  
 {  
 // **************************************** member variable  
 public:  
   char subname[10][20];  
   char subcode[10][20];  
   float gpa[10];  
   float credit[10];  
   float totalcredit;  
   float subg[10];  
   float total;  
   int i;  
   float grade;  
   char gradeno[4];  
 //**************************************** member function  
 public:  
   void getgpa();  
   void file();  
   void gra(float);  
 };  
 //****************************************  
 //grade calculation  
 //****************************************  
 void cgpa::gra(float k)       // from 171  
 {  
   while(1)  
   {  
     if(k<=.99)  
     {  
       strcpy(gradeno,"F"); //**********string copy  
       break;  
     }  
     else if(k<=1)  
     {  
       strcpy(gradeno,"D" );  
       break;  
     }  
     else if(k<=1.30)  
     {  
       strcpy(gradeno,"D+" );  
       break;  
     }  
     else if(k<=1.70)  
     {  
       strcpy(gradeno,"c-" );  
       break;  
     }  
     else if(k<=2)  
     {  
       strcpy(gradeno,"c" );  
       break;  
     }  
     else if(k<=2.3)  
     {  
       strcpy(gradeno,"c+" );  
       break;  
     }  
     else if(k<=2.70)  
     {  
       strcpy(gradeno,"B-" );  
       break;  
     }  
     else if(k<=3.0)  
     {  
       strcpy(gradeno,"B" );  
       break;  
     }  
     else if(k<=3.3)  
     {  
       strcpy(gradeno,"B+" );  
       break;  
     }  
     else if(k<=3.70)  
     {  
       strcpy(gradeno,"A-" );  
       break;  
     }  
     else if(k<=4.0)  
     {  
       strcpy(gradeno,"A" );  
       break;  
     }  
     else if(k==4)  
     {  
       strcpy(gradeno,"A+" );  
       break;  
     }  
   }  
 }                    // goto 171  
 //************************************** getting subject code & credit  
 void cgpa::getgpa() //come in 174  
 {  
   get(); // goto line 22  
   totalcredit =0;  
   total=0;  
   cout<<"\n+++++++++++++++++  ABOUT RESULT \n";  
   cout<<"\n  HOW MANY SUBJECT IN HIS/ HER EXAM HE/SHE ATTEND =  ";  
   cin>>i;  
   for(int j=0; j<i; j++)  
   {  
     cout<<"\n";  
     cout<<" [] SUBJECT NAME      =  ";  
     cin>>subname[j];  
     cout<<" [] SUBJECT CODE      =  ";  
     cin>>subcode[j];  
 Y:  
     cout<<" [] CREDIT OF THAT SUBJECT =  ";  
     cin>>credit[j];  
     if(credit[j]<=4)  
     {  
       cout<<"";  
     }  
     else  
     {  
       cout<< "\n..............................\n   EROR 404 \n YOUR input WAS WRONG (-_-)\n [ please try again ] \n..............................\n";  
       goto Y;  
     }  
 z:  
     cout<<" [] GPA OF THAT SUBJECT   =  ";  
     cin>>gpa[j];  
     if(gpa[j]<=credit[j])  
     {  
       cout<<"";  
     }  
     else  
     {  
       cout<< "\n..............................\n   EROR 404 \n YOUR input WAS WRONG (-_-)\n [ please try again ] \n..............................\n";  
       goto z;  
     }  
     cout<<"\n+++++++++++++++++  ";  
     totalcredit=totalcredit+credit[j];  
     subg[j]=gpa[j]*credit[j];  
     total=subg[j]+total;  
   }  
 // grade calculation  
   grade=total/totalcredit;  
   cout<<"\n [] RESULT         =  "<<grade;  
   gra(grade);         // goto line 58  
   cout<<"\n [] GRADE          =  "<<gradeno;  
   cout<<"\n********************************************************************************\n";  
 // result store kora hoyeche  
   fstream x("RESULT",ios::app|ios::out);  
   x<<endl<<"\t"<<name<<"\t"<<roll<<"\t"<<grade<<"\t"<<gradeno<<endl;  
   x.close();         // back to 174  
 }  
 //******************************(IT STORE MY INFORMATION USING FILE )  
 void cgpa::file()  // come in from 219  
 {  
   getgpa(); // goto line 115  
   ofstream out(roll);  
   out<<"\n  NAME    = "<<name;  
   out<<"\n  ROLL    = "<<roll;  
   out<<"\n  DEPARTMENT = "<<dep;  
   out<<"\n  BATCH    = "<<batch;  
   out<<"\n\n\n SUBJECT NAME = Subject Code --- CREDIT of that SUBJECT---YOUR GPA ";  
   for(int j=0; j<i; j++)  
   {  
     out<<"\n";  
     out<<" "<<subname[j];  
     out<<"\t\t  "<<subcode[j];  
     out<<"\t\t  " ;  
     out<<credit[j];  
     out<<"  \t\t\t" ;  
     out<<gpa[j];  
   }  
   out<<"\n------------------------------\n\n  TOTAL CREDIT   = "<<totalcredit;  
   out<<"\n\n  TOTAL GRADE POINT = "<<grade;  
   out<<"\n\n  CGPA       = "<<gradeno;  
   out<<"\n********************************************************************************\n";  
   out.close();  // end of file // end of input 1  
 }  
 //*****************************************************************************( MAIN FUNCTION )  
 int main()  
 {  
   int p;  
   system("color 2");//color  
   while(1)  
   {  
     cout<<"\n  \t\t \t ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n";  
     cout<<" \t\t\t|   ""EAST WEST UNIVERSITY\t  |";  
 z:  
     cout<<"\n \t \t\t ---------------------------------- \n \t \t\t|    SELECT YOUR OPTION    |\n\t\t\t|\t\t\t\t  |";  
     cout<<"\n ";  
     cout<<"\t\t\t| 1...INPUT\t\t\t  |\n \t\t\t| 2...SEARCH\t\t\t  |\n    \t \t| 3...SHOW ( TOTAL RECORD )\t  | \n \t\t\t| 4...LOGOUT\t\t\t  |";  
     cout<<"\n\t\t\t ----------------------------------\nYOU CHOOSE= ";  
     cin>>p;  
     cout<<"-----------------------------------------------------------";  
     system("cls");  
     if(p==1)  
     {  
       cout<<"\n\t\t\tBASIC INFORMATION :\n";  
       cgpa x;  
       x.file(); //goto line 172  
     }  
     else if(p==2)  
     {  
       //system("cls");  
       cout<<"\n\n  INPUT The ROLL  = ";  
       char roll[20];  
       cin>>roll;  
       cout<<"\n";  
       cout<<"------------------------------HERE WE FOUND ";  
       cout<<"\n";  
       char c;  
       ifstream x(roll); ///////  
       if(!x)  
       {  
         cout<<"\nWE CAN'T FIND ANYTHING \n\n";  
         cout<<"------------------------------";  
       }  
       else  
         while(x)  
         {  
           x.get(c);  
           cout<<c;  
         }  
     }  
     else if(p==3)  
     {  
       char c;  
       cout<<"\n\n\n\tTOTAL RECORD are HERE \n";  
       cout<<"-----------------------------------------------------------";  
       cout<<"\n\tNAME  ROLL  CGPA   GRADE\n";  
       cout<<"-----------------------------------------------------------";  
       ifstream x("RESULT");  
       if(!x)  
       {  
         cout<<"\nWE CAN'T FIND ANYTHING \n\n";  
         cout<<"------------------------------";  
       }  
       else  
         while(x)  
         {  
           x.get(c);  
           cout<<c;  
         }  
     }  
     else if(p==4)  
     {  
       cout<<"\n\n\n\tTHANK YOU FOR USING THIS PROGRAM !!!!!!!!\n\n\n\n\n\n\n\n\n";  
       break;  
     }  
     else  
     {  
       cout<<"\n";  
       cout<<"..............................\n   EROR 404 \n YOUR input WAS WRONG (-_-)\n [ please try again ] \n..............................";  
       cout<<"\n";  
       goto z;  
     }  
   }  
   return 0;  
 }