NUFFNANG

Sabtu, 19 Januari 2013

lect hampeh

spe r lect nie..

c++

sub yg memeningkan aku..
sapela creat bnd nie an..
asg dy xsiap g nie..
sok nak submit..
trok aku..
cmne nak present sok..
so far..
aku dh wat sket..

nie dy coding dy..


#include <iostream>
#include <fstream>
#include <cstdlib>
#include <iomanip>
using namespace std;
void askme();
void menu();
void user1();



void main ()
{

cout<<"             ==========================================================\n";
cout<<"             ====   Welcome To Multinationals Electrical Company   ====\n";
cout<<"             ====  www.mec.com.my  Tel=07-2518683 Fax= 07-2518688  ====\n";
cout<<"             ==========================================================\n\n\n";
user1();
menu();


}

void user1()

{

int x,str;
int user,z;




ofstream a_file ( "Password.txt" );
a_file<<"2";
a_file.close();
ifstream b_file ( "Password.txt" );
b_file>> str;
cout<<"Enter your username :";
cin>>user;
cout<<"\nEnter your password : ";
cin>>x;

if (x==str)
{
cout<<"Great!!"<<endl;


}
else if (x==5)
{
cout<<"\n\nCounter closed.\n";
cout<<"Thank you."<<endl;
cout<<endl;
}
else
{
cout<<"\n\nInvalid password.Please try again.\n\n";
user1();


}

}

void menu()
{


char stock[20];
double price;
int y,quantity,sale,update;
cout<<"\n\nPlease select what process that you want\n";
cout<<"[1] Add new stock\n";
cout<<"[2] Sale stock\n";
cout<<"[3] Calculate stock\n";
cout<<"[4] Add user\n";
cout<<"[5] Logout\n";
cout<<" Your choose process number :";
cin>>y;


if (y==1)

{


cout<<"\n\nPlease insert the following data :\n\n";
cout<<"Stock name :";
cin>>stock;
cout<<"Stock quantity :";
cin>>quantity;
cout<<"Stock Price (per item): RM ";
cin>>price;
menu();
}

else if (y==2)
{
cout<<"\n\nPlease insert the following data :\n\n";
cout<<" Stock name :";
cin>>stock;
cout<<" Quantity sale :";
cin>>sale;
menu();
}


else if (y==3)
{

update =quantity-sale;
cout<<" Your current quantity is :"<<update<<endl;
menu();
}




else if(y==4)
   {
   cout<<"\n\nCounter closed.\n";
cout<<"Thank you."<<endl;
menu();
}

else if (y==5)
{
cout<<"\n\nCounter closed.\n";
cout<<"Thank you."<<endl;
cout<<endl;

}

else
{
cout<<"\n\n                 ' wrong input '";
menu();
}


}




void askme()
{

int w;
cout<<"\n\nPress 01 to main menu";
cout<<"\nYour choose :";
cin>>w;

if (w==01)
{

menu();
}

else
{
cout<<"Wrong input!";
askme();
}
}

IKLAN NUFFNANG

HB