C++

Can anyone help me on my assignment? i am new in c++, i don't even know how to start when making a program in c++.. please help..

the out put should look like this :

1.) Open Account
2.) Deposit Transaction
3.) Cash Withdrawal
4.) Inquiry
5.) Close account
6.) Exit

( i would be very happy if there's someone who will help.)
Hello! I would recommend reading some of the pages on this website, it's very helpful. I'd start at the basics, http://www.cplusplus.com/doc/tutorial/program_structure/ .

On to your specific problem: If I'm understanding you correctly, you just want the program to display the 1-6 options, that's all? If so, try this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>

using namespace std;

int main()
{

cout << "1.) Open Account" << endl;
cout << "2.) Deposit Transaction" << endl;
cout << "3.) Cash Withdrawal" << endl;
cout << "4.) Inquiry" << endl;
cout << "5.) Close Account" << endl;
cout << "6.) Exit" << endl;

return 0;

}


An explanation of what I did:

#include <iostream> , using namespace std; and int main() are all required for your program to function. I would get in the habit of remembering these three, as you'll be using them in a lot of your programs.

cout << "blah blah blah" is telling the program to display blah blah blah to the user. What's in the quotes is what is going to be displayed. << endl; is telling the program to basically hit the "enter" button on your keyboard.

Return 0; makes the main function finish.

If you have any more questions, feel free to ask! I hope I helped!
not only that...
just for example,, the number 1-6 must have a function if you clicked it..
Doing what, exactly? I can't read your mind. Please elaborate further.

Last edited on
i mean, for each option must have a function according to their specified number.
Well, that didn't really help. There's such a thing as a "function" in C++ ( http://www.cplusplus.com/doc/tutorial/functions/ ), but considering you said you're new to C++ and you don't even know where to start, I doubt that's what you're looking for.

I would assume what you're asking for is for it to do something specific whenever the number is entered. Again, I assume that it is super basic, and you're looking for a simple cout statement to accompany the item, but you're not specifically stating what you're wanting. I'm having a difficult time trying to figure out what you want, so please state exactly what you want to display. For example:

"If the user types 1, the program types 'Moo'. If the user types 2, the program shows 'Meow'. If the user types 3, the program ends."

Maybe it's just that it's 1:18AM, and I'm tired, but I'm still unsure of what you want so, again, please explain in detail what you want the program to do.
Ice warrior gave you exactly what you asked for, but it
s not what you want. I guess you need to read the assignment paper once more and find out what YOU are supposed to do.

If you want info typed by the user, look up cin.
i don't know how to explain it any further, because i'm not good in english..
i already have a code for it.. but it always has an error..

please help me with this... ( i think this could help to make you realize how would i wanted it to look like )

#include <iostream>
# include <conio.h>
using namespace std;

int main()
{

int input;

cout<<"\n";
cout<<" WELCOME TO MY C BANK"<<"\n\n\n";
cout<<" MENU"<<"\n\n";
cout<<" [1] Open Account"<<"\n";
cout<<" [2] Deposit Transaction"<<"\n";
cout<<" [3] Cash Withdrawal"<<"\n";
cout<<" [4] Inquiry"<<"\n";
cout<<" [5] Close Account"<<"\n";
cout<<" [6] EXIT"<<"\n";

cout<<" Please enter your choice: ";
cin>>input;


switch (input)
{
case 1:
if(input ='1')
{
char char1[50];
int a,id;

cout<<" Enter Your Name: ";
cin>>char1;
cout<<" Enter Your Initial Deposit: ";
cin>>a;
cin.ignore();
id= 100009;//fixed value
cout<<" Thank You For Registering An Account " <<char1 <<"\n";
cout<<" Your Account Number Is: " << id <<"\n";
cin.get();
return 0;

}
break;

case 2:
if(input ='2')
{
int b,cd;
cout<<" Enter Your Initial Deposit: ";
cin>>b;
cout<<" Enter Your Cash Deposit: ";
cin>>cd;
cin.ignore();
cd =(b + cd);
cout<<" Your Cash Deposit Is= " <<cd <<"\n";
cin.get();
return 0;
}
break;

case 3:
if (input ='3')
{
int cd,cw;
cout<<" Enter Your Cash Deposit: ";
cin>>cd;
cout<<" Enter Your Cash Withdrawal: ";
cin>>cw;
cin.ignore();
cw =(cd - cw);
cout<<" You Now Have " <<cw <<"\n";
cout<<" Left In Your Account" <<"\n";
cin.get();
return 0;
}
break;

case 4:
if (input ='4')
{
int acct,cd;
char char1;
cout<<" Enter Your account number: ";
cin>>acct;
if (acct=10000)
{
cout<<" Account Name: "<<char1<<"\n";
cout<<" Current Balance: "<<cd<<"\n";
}
return 0;
}

break;
case 6

if (input ='6')
{
char char1;
cout<<" EXIT"<<"\n";
cin>>char1;
cin.get();
return 0;
}
break;

}
cin.get();
}
Topic archived. No new replies allowed.