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

in #utopian-io7 years ago (edited)

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

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

Sort:  

Thank you for the contribution. It has been approved.

Note: You need to explain every of your codes while typing them on screen.

You can contact us on Discord.
[utopian-moderator]

Thanks a lot @rufans for your advice.
I'll improve it for my next contribution.

Hey @devarizaldi I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Congratulations @devarizaldi! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got a First Reply

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!