Pages

Monday, April 15, 2013

Shop Management Project in C

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <process.h>
#include <stdlib.h>

class list
    {
    int count;
    char serial[30][30];
    char name[30][30];
    char price[30][30];
    char quality[30][30];
    char quantity[30][30];
    public:
    void goods();
    void order_goods();
    void show_goods();
    };

void list::order_goods()
    {
    char pid[30];
    long qid;
    int found=0;
    cout<<"Enter Product id: ";
    cin>>pid;
    int v;
    for(v=0;v<count;v++)
      {
      if(strcmp(serial[v],pid)==0)
        {
        found=1;
        break;
        }
      }
    if(found==1)
      {
      char read;
      cout<<"Enter quantity(kg): ";
      cin>>qid;
      AA:
      cout<<"Are you sure of ordering "<<qid<<" kg of "<<name[v];
      cout<<"\nEnter (y/n)";
      cin>>read;
      if(read==121)
      {
      fstream fout;
      fout.open("list.txt",ios::out);
      long sum=0;
      int d=1;
      for(int s=strlen(quantity[v])-1;s>=0;s--)
        {
        sum+=(quantity[v][s]-48)*d;
        d*=10;
        }
      sum+=qid;

      //sum=(long)quantity[v];
      //cout<<"sum"<<sum;

      itoa(sum,quantity[v],10);

      for(int m=0;m<count;m++)
        {
        fout<<serial[m]<<";";
        fout<<name[m]<<";";
        fout<<price[m]<<";";
        fout<<quality[m]<<";";
        fout<<quantity[m]<<";"<<"\n";
        }
        long ati=atoi(price[v])*qid;
      cout<<"\n"<<ati <<" taka has been truncated from shop account\n";
      }
      else if(read==110);
      else
      {
      clrscr();
      goto AA;
      }
      //char y='n';
      //printf("%d",y);
      }
    }
void list::goods()
    {
    char pricestr[20];
    char str[2000];
    ifstream fin;
    fin.open("list.txt",ofstream::in);

    //char s[2000];
     count=0;
    while(fin>>str)
      {

      int savei=0;
      //cout<<str;
     //   cout<<strlen(str)<<" ";
     int i=0;
     int d=0;
      while(i<strlen(str))
      {

      if(str[i]==';')
        {

      //cout<<"Savei="<<savei<<"\t"<<"i="<<i<<" ";
      char s[30];
      int l=0;
      for(int j=savei;j<i;j++)
          {
          s[l]=str[j];
          l++;
          }
          s[l]='\0';
      if(d==0)
      strcpy(serial[count],s);
      else if(d==1)
      strcpy(name[count],s);
      else if(d==2)
      strcpy(price[count],s);
      else if(d==3)
      strcpy(quality[count],s);
      else if(d==4)
      strcpy(quantity[count],s);
      d++;
       //cout<<"strlen="<<l<<",s="<<s<<"\n";
      //char tab='\t';
      //printf("%5c",tab);

       i++;
       savei=i;
        }
      //printf("%c",str[i]);

      i++;

      }
      count++;
      if(fin.eof())
      break;
      //cout<<"\n";
      }
      fin.close();


      }
      void list::show_goods()
      {
      cout<<"p-id\t name\t  price\t   quality\tquantity(kg)\n";
    cout<<"-----------------------------------------------------------\n";
      for(int v=0;v<count;v++)
      {
      printf("%s",serial[v]);
      printf("%8s",name[v]);
      printf("%8s",price[v]);
      printf("%15s",quality[v]);
      printf("%10s",quantity[v]);
      printf("\n");
      }
      }
void main()
{
A:
clrscr();
cout<<"Make your choice:\n[1] For see products\n[2] For order products\n[3] For quit\n\n";
list ob;
char a;
cin>>a;
clrscr();
ob.goods();
if(a==49)
ob.show_goods();
else if(a==50)
ob.order_goods();
else if(a==51)
exit(0);
else
goto A;
cout<<"\n\nPress any key to return to Main Menu.";
getch();
goto A;

}

////////////////////////////////////////////////////////////////////////////
You must include a file "list.txt",You can include data in this file "list.txt" like below,

12001;salt;20;good;1022;
12002;sugar;35;excellent;1104;
12003;Milk;42;excellent;500;
12004;Rice;23;good;2523;
12005;Atta;35;excellent;100023;

///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........

Library Management System project in C

#include<stdlib.h>
#include<iostream.h>
#include<string.h>

#define MAX    100

class bookEntry{
public:
    int copies;
    char name[30];
    char author[30];
};

class library{
public:
    int numBooks;
    bookEntry database[MAX];

    library(){
        numBooks = 0;
    }
    void insertBook( char bookName[], char author[], int c);
    void deleteBook( char bookName[]);
    bookEntry *search( char bookName[]);
};

void library::insertBook( char bookName[], char author[], int c){
    strcpydatabase[numBooks].name, bookName);
    strcpydatabase[numBooks].author, author);
    database[numBooks].copies = c;
    cout << "Book Inserted Successfully.\n";
    ++numBooks;
}

void library::deleteBook( char bookName[]){
    int i;
    for( i = 0; i < numBooks; i++){
        if( strcmp( bookName, database[i].name) == 0){
            database[i].copies--;
            cout << "Book Deleted Successfully.\n";
            return;
        }
    }
    cout << "Book not found.\n";
}

bookEntry *library::search( char bookName[]){
    int i;
    for( i = 0; i < numBooks; i++){
        if( strcmp( bookName, database[i].name) == 0)
            return &database[i];
    }
    return NULL;
}

int main(){
    library lib;

    char option, name[30], author[30], copies[10];
    while( 1 ){
        cout << "\nEnter your option:\n";
        cout << "I for insert\n";
        cout << "D for delete\n";
        cout << "S for search\n";
        cout << "E for exit\n";

        cin.getline( name, 80);
        option = name[0];

        switch( option){

        case 'i':
            cout << "Enter Name of Book, Author and no of copies per line:\n";
            cin.getline( name, 80);
            cin.getline(author, 80);
            cin.getline(copies, 80);
            lib.insertBook( name, author, atoi(copies));
            break;
        case 'd':
            cout << "Enter Name of Book:\n";
            cin.getline(name, 80);
            lib.deleteBook(name);
            break;
        case 's':
            cout << "Enter Name of Book:\n";
            cin.getline(name, 80);
            bookEntry *item;
            item = lib.search( name );
            if( item != NULL){
                cout << "Book found\n" << item->name << endl << item->author << endl << item->copies << endl;
            }
            else
                cout << "Book not found\n";
            break;
        case 'e':
            exit(0);
            break;
        }
    }
    return 0;
}

How to Use Google+ Hangouts


  1. Go to the home screen of Google+, where you should see your stream of friends' activity. In the right sidebar, you should see the Hangouts section. Click on the green "Start a hangout" button.

  2. 2
    A window will pop up, asking you to check your video camera and microphone. Click "Add more people" to select specific circles to hang out with.
    • Google+ automatically inserts everyone you have placed into a circle in the field, but you can click on the "x" next to "Your circles" to avoid inviting everyone to hang out.

  3. 3
    Once you have clicked "Add more people," a drop-down menu will pop up to help you select from your circles to add.
  4. 4
    Click the green "Hang out" button to confirm your invitations. A window will pop up with everyone else in the room, and you all can begin to use the available features in the bottom toolbar.

  5. 5
    To invite more people into the hangout, press the "Invite" button. It's the leftmost button in the toolbar. Press the "add" link to select specific people or circles to add to the room.

  6. 6
    To instant message everyone in the hang out, press the "Chat" button. It's the button that's second from the left in the toolbar.
    • Type your message in the box and press the enter key on your keyboard to send. Your message will be available to everyone, and it will be formatted like a conversation on Google Chat and Google Talk.

  7. 7
    To watch a YouTube video with everyone in the room, press the "YouTube" button. It's the third from the left in the toolbar. YouTube will pop-up in the main window for everyone, and then you can begin picking videos to watch.

  8. 8
    To mute your video, press on the icon that's fourth from the right. This will make it so that your camera blacks out and no one in the room can see you.

  9. 9
    To mute your microphone, press the icon that's third from the right. This will make it so that when you speak, no one in the room can hear you.

  10. 10
    To change your camera, microphone or sound settings, choose the icon that's second from the right. A pop-up window will appear over the other things in the room and you can adjust your options as necessary.

  11. 11
    When you are finished with the hangout, say goodbye to everyone and press "Exit." It's the rightmost icon in the toolbar.

Differences between SQL and MySQL



Many programmer and many students have a little confusion about the difference between SQL and MySQL. It's a common question to the new programmer about the differences between them. If you browse several blog or blog posts or forum posts related to SQL and MySQL, you may notice several questions like
 What is the difference between SQL and MySQL? or What is the main difference SQL and MySQL? orMention the simple difference between SQL and MySQL. or Is SQL is a part of MySQL? or Why MySQL differs from SQL? or Does SQL and MySQL are the same?

etc. To answers this type of questions, this page is written. Moreover, most interview board asks these type of questions at the interview time. So, to know about these types of question's answers, just read the followings...

Differences between SQL and MySQL

SQL stands for Structured Query Language. It's a standard language for accessing and manipulating databases.
MySQL is a database management system, like SQL Server 2005, Oracle, Informix, Postgres etc. MySQL is a RDMS (Relational Database Management System). All types of RDMB use SQL.
SQL is used to manipulate database or to create a database. It's actually a common language. MySQL is an actual computer application. You must need to download or collect it and install it. MySQL is one of the most popular open source database management system. MySQL has an SQL interpreter.
MySQL can be used as the back engine database for several kinds of applications and it's one of the best choice for many web programmers for web-base application.
All these are the differences between SQL and MySQL. If you want to mention further differences, you may add them to the comment section.