Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Help With Code


Destroy
 Share

Recommended Posts

Write a C++ program to simulate typical bank account processes by incorporating the following requirements:

1. Declare a variable to store the account number as string with no more than 8 characters.

2. Declare a variable to store the transaction date as a string with no more than 10 characters.

3. Declare a variable to store the transaction description as a string with no more than 36 characters.

4. Declare a variable to store the transaction amount as a decimal value.

5. Declare a variable to store the account balance as a decimal value.

6. Request the account number from the user and store this value in the variable you previously created.

7. Request the transaction date from the user and store this value in the variable you previously created.

8. Request the transaction description from the user and store this value in the variable you previously created.

9. Request the transaction amount from the user and store this value in the variable you previously created.

10. Request the account balance from the user and store this value in the variable you previously created. 11. Using the data that was assigned to the variables in the previous steps, print to the standard output a transaction report formatted exactly as follows:

CPSC-120 Fall 2018 Steve May ========================================================================

ACCOUNT: 12345678 DATE DESCRIPTION AMOUNT BALANCE ========== ==================================== ========== ========== 03/01/2018 Initial Deposit 1000.00 1000.00

 

 

NOTE: The first line should have your own name. The data values on the report for the account, date, description, amount, and balance should come from the information you requested from the user and stored in the respective data variables.

 

Ok thingis i dont understand how to create a string with no more than 8 character.

 

 

 

 

https://gyazo.com/40...138ba56d9e8d08f this link is the code which works now

https://gyazo.com/49...80fa423bf2c28d6 this is the terminal that ran the code

https://gyazo.com/ee...ad66d1b2ccd7046 this is how they want to set it up to be but i dont know how to set up the setwidth between each other thats all i need help with now, the rest i figured out

Edited by Destroy
Link to comment
Share on other sites

Moved to a more appropriate section.

 

If the assignment actually wants the variables to be strings then I think Kevin has the right idea.

 

It sounds like using a char array might be fitting but I haven't done too much C++ so that is probably more trouble than it's worth.

A char array would work but it is asking specifically for a string datatype.

Link to comment
Share on other sites

boi we're not bouta do your homework

(and plus i dont know any C++)

Moved to a more appropriate section.

 

If the assignment actually wants the variables to be strings then I think Kevin has the right idea.

 

It sounds like using a char array might be fitting but I haven't done too much C++ so that is probably more trouble than it's worth.

 

https://gyazo.com/40...138ba56d9e8d08f this link is the code which works now

https://gyazo.com/49...80fa423bf2c28d6 this is the terminal that ran the code

https://gyazo.com/ee...ad66d1b2ccd7046 this is how they want to set it up to be but i dont know how to set up the setwidth between each other thats all i need help with now, the rest i figured out

Edited by Destroy
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share