4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

C++ Tutorial : How to Create a Phone-Store program in C++ using CodeLite

cover.png

Video : English - HD 720p

Github : eranif/codelite


What Will We Learn?

  • We will learn about Array
  • We will learn about IF_ELSE IF_ELSE
  • We will learn about create a Phone-store program in C++ using Codelite

Requirements

  • Microsoft Windows (32 bit or 64 bit)
  • CodeLite IDE

Difficulty

  • Intermediate

Description

In this video we will discuss about Array, IF-ELSE IF - ELSE & Create a Phone-store program. We can start from array. Array is a structured data type that is using for stores a number of data from the same type. Array has characteristics such as data types that can be hold more than one data, access time equals for every element, accessible at random and also the most convenient data storage structure. Then, we learn about IF_ELSE IF_ELSE conditions. First, we will explain about IF. It's a condition where the content inside is correct or that condition is true then it will be executed. Second, we have additional condition is ELSE IF that will be executed if the condition of IF is false or the value is not appropriate. And last, we have last optional that is ELSE. It will be used if the contents from IF not correct or the value is false. Now, we will to create the program about create a simple program for Phone-Store in C++ programming language using CodeLite.

Video Tutorial

This video explained in English - HD 720p
https://youtu.be/SAn01prsZ4k

The following codes used in this video

#include<iostream> 
#include<conio.h> 
#include<istream> 
using namespace std;
int main()
{
    string code, fname, lname, address, anw;
    string a[1] = {"DPhone"};
    string b[3] = {"Gray","Silver", "Gold"};
    int price[3] = {4000000, 4500000, 5000000};
    cout<<"-------------WELCOME TO DR-STORE-------------"<<endl;
    cout<<endl;
    cout<<"Please entry in below"<<endl;
    cout<<endl;
    cout<<"Enter first name: "; cin>>fname;
    cout<<"Enter last name: "; cin>>lname;
    cout<<"Enter Address: "; cin>>address;
    cout<<endl;
    cout<<"------------DPhone Collection-------------"<<endl<<endl;
    cout<<"Hallo "<<fname<<" "<<lname<<" !,Please check our product in below:"<<endl;
    cout<<"--------------------------------------------"<<endl;
    cout<<"Code : DGRAY     => "<<a[0]<<"-"<<b[0]<<"  \t IDR."<<price[0]<<endl;
    cout<<"Code : DSLVR     => "<<a[0]<<"-"<<b[1]<<"\t IDR."<<price[1]<<endl;
    cout<<"Code : DGOLD     => "<<a[0]<<"-"<<b[2]<<"  \t IDR."<<price[2]<<endl;
    cout<<"------------------------------------------"<<endl;
    cout<<"Enter the code for phone you want to purchase: "; cin>>code;
      if (code == "DGRAY")
    {
        cout<<"Phone : "<<a[0]<<endl;
        cout<<"Color : "<<b[0]<<endl;
        cout<<"Price : "<<"IDR."<<price[0]<<endl;
        cout<<"Are you sure to buy this DPHONE ?";
        cin>>anw;
        cout<<endl;
        if (anw=="y"){
            cout<<"---------THANKS FOR PURCHASE-----------"<<endl<<endl;
            cout<<"Name    : "<<fname<<" "<<lname<<endl;
            cout<<"Address : "<<address<<endl;
            cout<<"Purchase success !"<<endl;
            cout<<endl;
           }
        else if (anw=="n")
            cout<<"----------THANK YOU FOR VISITING------- \n ---------PLEASE COME AGAIN !------"<<endl<<endl;
        }
    else if (code == "DSLVR")
    {
        cout<<"Phone : "<<a[0]<<endl;
        cout<<"Color : "<<b[1]<<endl;
        cout<<"Price : "<<"IDR."<<price[1]<<endl;
        cout<<"Are you sure to buy this DPHONE ?";
        cin>>anw;
        cout<<endl;
        if (anw=="y"){
            cout<<"---------THANKS FOR PURCHASE-----------"<<endl<<endl;
            cout<<"Name    : "<<fname<<" "<<lname<<endl;
            cout<<"Address : "<<address<<endl;
            cout<<"Purchase success !"<<endl;
            cout<<endl;
        }
        else if (anw=="n")
            cout<<"----------THANK YOU FOR VISITING------- \n ---------PLEASE COME AGAIN !------"<<endl<<endl;
        }    
       else if (code == "DGOLD")
    {
        cout<<"Phone : "<<a[0]<<endl;
        cout<<"Color : "<<b[2]<<endl;
        cout<<"Price : "<<"IDR."<<price[2]<<endl;
        cout<<"Are you sure to buy this DPHONE ?";
        cin>>anw;
        cout<<endl;
        if (anw=="y"){
            cout<<"---------THANKS FOR PURCHASE-----------"<<endl<<endl;
            cout<<"Name    : "<<fname<<" "<<lname<<endl;
            cout<<"Address : "<<address<<endl;
            cout<<"Purchase success !"<<endl;
            cout<<endl;
        }
        else if (anw=="n")
            cout<<"----------THANK YOU FOR VISITING------- \n ---------PLEASE COME AGAIN !------"<<endl<<endl;
        }
    else 
        cout<<"Invalid code !"<<endl<<endl;
        return 0;
}

Curriculum

You can learn about video tutorial of c++ in below :



Posted on Utopian.io - Rewarding Open Source Contributors

7 upvotes $9.69

Replies (6)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: