Sunday, 13 January 2019

casino game project in C++

#include <iostream>
#include <string> // Needed to use strings
#include <cstdlib> // Needed to use random numbers
#include <ctime>
using namespace std;

void drawLine(int n, char symbol);
void rules();

int main()
{
    string playerName;
    int amount; // hold player's balance amount
    int bettingAmount;
    int guess;
    int dice; // hold computer generated number
    char choice;

    srand(time(0)); // "Seed" the random generator

    drawLine(60,'_');
    cout << "\n\n\n\t\tCASINO GAME\n\n\n\n";
    drawLine(60,'_');

    cout << "\n\nEnter Your Name : ";
    getline(cin, playerName);

    cout << "\n\nEnter Deposit amount to play game : $";
    cin >> amount;
   
    do
    {
        system("cls");
        rules();
        cout << "\n\nYour current balance is $ " << amount << "\n";

// Get player's betting amount
        do
        {
            cout <<playerName<<", enter money to bet : $";
            cin >> bettingAmount;
            if(bettingAmount > amount)
                cout << "Your betting amount is more than your current balance\n"
                       <<"\nRe-enter data\n ";
        }while(bettingAmount > amount);

// Get player's numbers
        do
        {
            cout << "Guess your number to bet between 1 to 10 :";
            cin >> guess;
            if(guess <= 0 || guess > 10)
                cout << "Please check the number!! should be between 1 to 10\n"
                    <<"\nRe-enter data\n ";
        }while(guess <= 0 || guess > 10);

        dice = rand()%10 + 1; // Will hold the randomly generated integer between 1 and 10
   
        if(dice == guess)
        {
            cout << "\n\nGood Luck!! You won Rs." << bettingAmount * 10;
            amount = amount + bettingAmount * 10;
        }
        else
        {
            cout << "Bad Luck this time !! You lost $ "<< bettingAmount <<"\n";
            amount = amount - bettingAmount;
        }

        cout << "\nThe winning number was : " << dice <<"\n";
        cout << "\n"<<playerName<<", You have $ " << amount << "\n";
        if(amount == 0)
        {
            cout << "You have no money to play ";
            break;
        }
        cout << "\n\n-->Do you want to play again (y/n)? ";
        cin >> choice;
    }while(choice =='Y'|| choice=='y');
   
    cout << "\n\n\n";
    drawLine(70,'=');
    cout << "\n\nThanks for playing game. Your balance amount is $ " << amount << "\n\n";
    drawLine(70,'=');

    return 0;
}

void drawLine(int n, char symbol)
{
    for(int i=0; i<n; i++)
        cout << symbol;
    cout << "\n" ;
}

void rules()
{
    system("cls");
    cout << "\n\n";
    drawLine(80,'-');
    cout << "\t\tRULES OF THE GAME\n";
    drawLine(80,'-');
    cout << "\t1. Choose any number between 1 to 10\n";
    cout << "\t2. If you win you will get 10 times of money you bet\n";
    cout << "\t3. If you bet on wrong number you will lose your betting amount\n\n";
    drawLine(80,'-');
}

// END OF PROGRAM

Sunday, 6 May 2018

Computer Security

Computer security deals with the prevention and detection of unauthorised actions by users of a computer system. It is concerned with measures we can take to
deal with intentional actions by parties behaving in some unfamiliar way.
Computer security is needed to protect the computing system and to protect the data that they store and access. Security interfaces with the working patterns
users are accustomed to and tells abouts the controlling access to information and resources. It mainly focuses on the security attacks, security mechanism and security
services.

Benefits of Using Cryptography

1. Confidentiality − Encryption technique can guard the information and communication from unauthorized revelation and access of information.
2. Authentication − The cryptographic techniques such as MAC and digital signatures can protect information against spoofing and forgeries.

3. Data Integrity − The cryptographic hash functions are playing vital role in assuring the users about the data integrity.

4. Non-repudiation − The digital signature provides the non-repudiation service to guard against the dispute that may arise due to denial of passing message by the sender.

Types of Cryptography?

Cryptography को Mainly दो Parts मे Divide किया जाता है |
1. Symmetric Cryptography - इसमें Encryption और Decryption दोनों की Keys Same होती है मतलब की इसमें एक ही Key का इस्तेमाल करके Data या information को Encrypt और Decrypt किया जाता है |



2. Asymmetric Cryptography -  इसमें Encryption और Decryption दोनों की Keys Same नहीं होती है मतलब की इसमें Encryption करने के लिए Public Key का इस्तेमाल किया जाता है और Decryption करने के लिए Private Key का इस्तेमाल किया जाता हैं |

What is Decryption in Cryptography?

Cryptography मे Decryption एक ऐसी प्रक्रिया होती हैं जिसमे की Encrypted Data को वापस Plain Text मे Convert किया जाता है | Cipher Text को Plain Text मे Convert करने की Process को Decryption कहा जाता है |

What is Encryption in Cryptography?

Cryptography मे Encryption एक ऐसी प्रक्रिया होती है जिसमे की Data या information को Unreadable Secret Codes मे Convert कर दिया जाता है और इस Converted Data को Cipher Text कहा जाता है और इसको आसानी से समझा नहीं जा सकता क्योंकि यह मशीनी भाषा मे होता है | इसे सिर्फ वही व्यक्ति समझ सकता है जिसके पास इस Encrypted हुए Data को Decrypt करने की Key मौजूद हो मतलब की इसे वापस Plain Text मे Convert करने की Key हो | Plain Text को Cipher Text मे Convert करने की Process को ही Encryption कहा जाता है |

What is Cryptography in Hindi?

Cryptography शब्द Greek शब्द Krypto से बना है जिसका मतलब "Hidden Secrets" होता है | आसानी से शब्दों मे Cryptography का मतलब होता है "The Art of Protecting Data / Information" | इसके द्वारा आप अपने Data को Unreadable Secret Codes मे बदल सकते हैं जिन्हे Cipher Text कहा जाता है और इस Data को वही Read कर सकता है जिसके पास इसको Decrypt करने की Secret Key होगी | Decrypt हुए Data को Plain Text कहा जाता है | इसमें Encryption और Decryption दो Process होती है | इसका इस्तेमाल E-Mail Messages, Credit/Debit Card की Details तथा अन्य महत्वपूर्ण information को protect करने के लिए किया जाता है | Encryption मे Plain Text को Cipher Text मे Convert किया जाता है तथा Decryption मे Cipher Text को Plain Text मे Convert किया जाता है |

Banking System Project

//*************************************************************** //                   HEADER FILE USED IN PROJECT //********************...