Back | Reverse | Quick Reply | Post Reply |

C programming (Urgent? Yes.)
Link | by I love you on 2008-09-02 09:20:25 (edited 2008-09-02 09:27:03)
Actually, our professor didn't give us the problem in a statement form.
Instead, he just showed us the output of the program that we're supposed to code.

Output:


Enter number of integers from 1 to 10: 11
INVALID INPUT! TRY AGAIN!
Enter number of integers from 1 to 10: 3
Enter 3 integers...
Enter integer 1: 5
Enter integer 2: 3
Enter integer 3: 2
The sum is 10.
Input again? Y/N: Y
Enter number of integers from 1 to 10: 1
Enter 1 integer...
Enter integer 1: 5
Input again? Y/N: n
Goodbye!




And here's another longer one...


Welcome!
Main Menu:
1. Balance Inquiry
2. Deposit
3. Withdrawal
4. Exit
Enter your choice: b
INVALID CHOICE!

Main Menu:
1. Balance Inquiry
2. Deposit
3. Withdrawal
4. Exit
Enter your choice: 1

Balance Inquiry
Your Balance is Php 0.00.

Main Menu:
1. Balance Inquiry
2. Deposit
3. Withdrawal
4. Exit
Enter your choice: 2

Deposit
Enter amount to deposit: Php 500.00

Main Menu:
1. Balance Inquiry
2. Deposit
3. Withdrawal
4. Exit
Enter your choice: 3

Withdrawal
Enter amount to withdraw: Php 600.00
ERROR! Amount larger than remaining balance!
Enter amount to withdraw: Php 200.00

Main Menu:
1. Balance Inquiry
2. Deposit
3. Withdrawal
4. Exit
Enter your choice: 1

Balance Inquiry
Your Balance is Php 300.00.

Main Menu:
1. Balance Inquiry
2. Deposit
3. Withdrawal
4. Exit
Enter your choice: 4

Exit program.





That's all...I know, it's simple...but I have a problem with what loop to use and how to add a loop within a loop.

Re: C programming (Urgent? Yes.)
Link | by りんーちゃん on 2008-09-02 09:50:43
http://gendou.com/forum/thread.php?thr=22416
and maybe you'd like to share what you've done so far?


      
  m y . L i F E . i . t r a d e . i n . f o r . y o u r . P A i N .

Re: C programming (Urgent? Yes.)
Link | by gendou on 2008-09-02 09:50:43
I will not do your homework for you.
Instead, I will advise that you look for examples in your textbook or online.
If you have trouble with the most rudimentary of examples, it's time to read the textbook or find an online C tutorial.
Once you have given that an honest attempt, I will be happy to answer any specific questions you have.
This is not the place to go for a free lecture on how to conceptualize control flow in a computer program.
There are plenty of resources already available for that, like your textbook or online tutorials.


Re: C programming (Urgent? Yes.)
Link | by I love you on 2008-09-03 08:44:22 (edited 2008-09-03 08:46:40)
Thanks, Gendou~
I've checked out the net, and I've learned some concepts which are not found in our textbook. =__=
Like what you've said, I've got everything I need...
Now I just have to make the simplest and cleanest code as possible,
but hey, this is the best that I can do..(for now)


This code works and I think it's fine. But I can't say that it's the best..haha


Now we have a couple of problems here.
---If my choice in the given menu is any character aside from an integer,
it's supposed to display "Invalid Choice" and display the menu again...
But when I run the program, it just keeps on displaying a series of matrix.
---When I deposit an amount, and then ask for my balance, why doesn't my balance change and automatically be updated?
And when I withdraw an amount, (which is less than the balance) it just keeps on asking again to input an amount to withdraw...

Hey, I did my research (just as you've told me),
and I know that this will take some of your time, but can you puh-lease help me out on this? Please?

Re: C programming (Urgent? Yes.)
Link | by h4xordude on 2008-09-05 13:36:05 (edited 2008-09-05 13:44:17)
(Hopefully I made it in time...)

Hey Hikaru, first here's a few tips to see if you can do it on your own:

1) Use 'double' instead of 'float', float has a tendency to get weird at least for me whenever using decimals.

2) Replace the "status = scanf..." and "if status == 1" line with a while loop that starts with "while (scanf("%d", &option) != EOF){". A while loop is pretty much all you need in this instance, and using it this way will get it to do what you want it to.





And lastly, if you still can't get it to work, you can use this code (I've tested it, it works 100%, but I have it set to USD instead of Php)
click here to see


Can I have a cookie now?

Beware the quiet people, You don't know their intentions
(small signatures are sooo much cooler since they don't annoy people trying to read through posts!)

Re: C programming (Urgent? Yes.)
Link | by I love you on 2008-09-06 07:49:51 (edited 2015-05-01 07:41:48)
omg, thanks...

haha, it was checked last Thursday..
I was shaking and sweating (oh yes!) coz my teacher was like, "Okay, I'll give you five seconds to finalize -and correct- your work..."
I was in a panic mode...o__o

But hey, I made it in time...

----

-The float works just fine.. but yeah, double float might have been better.
-I've considered using the while loop here, but you see, you have to type the whole Menu 'again' at the end of the switch statement(which is redundancy, don't ya think?)

Re: C programming (Urgent? Yes.)
Link | by Zero^18 on 2008-11-28 07:50:58
who r u all really are...
did u all taking programming studies...

Re: C programming (Urgent? Yes.)
Link | by I love you on 2015-05-01 07:44:16
This was seven years ago. I feel embarrassed that I needed help for this very simple problem hahah... So nostalgic and embarrassing!

Re: C programming (Urgent? Yes.)
Link | by on 2015-05-10 00:08:48
Everyone needs help the first time, I did come here for help too!


Re: C programming (Urgent? Yes.)
Link | by larapeter on 2022-11-14 06:38:26
These are fascinating tips for beginner programmers. I often have many questions about java and also codes. Now I am studying in college and it is hard for me to do everything in time so I found the option of pay for programming homework https://domyprogramming.org/ this service. Thanks to these guys I was able to free up more time to deal with the topic and they created a great job for little money. Moreover, you can choose any type of programming help and it will be extremely useful for many!

Re: C programming (Urgent? Yes.)
Link | by maxmarrie on 2022-11-14 23:22:31 (edited 2022-11-14 23:23:07)
I am not familiar with this programming field, I am working with https://www.uniprint.net/en/
and if you want to know anything about cloud printing then you can ask it from me.

Re: C programming (Urgent? Yes.)
Link | by sarabanda on 2022-11-16 01:23:02
If programming is difficult for you, why would you do it in the first place? If you ever find out how long it takes to make an app, this will make you even more desperate. Programming is boring and requires a lot of patience.

Re: C programming (Urgent? Yes.)
Link | by garlicodour on 2023-01-05 22:41:16
I guess your institutuion is mistaken in just one small, but very important thing. When students don't understand the basics of the program, that can only mean that either there are too many students and too little time for each, or in the program is prevails theory. So mlops services https://dysnix.com/mlops-services must be developed and inplemented for machine learning. In this case you will get what you want much faster.

Re: C programming (Urgent? Yes.)
Link | by Rmq on 2023-01-15 17:07:25 (edited 2023-01-15 17:09:40)
The 5 best full-stack development books that I recommend reading:
1. ASP.NET Core 5 and React: Full-stack web development using .NET 5, React 17, and TypeScript 4, 2nd Edition;
2. Professional JavaScript: Fast-track your web development career using the powerful features of advanced JavaScript;
3. Hands-On Full Stack Development with Spring Boot 2 and React: Build modern and scalable full stack applications using Spring Framework 5 and React with Hooks, 2nd Edition;
4. Learn Red – Fundamentals of Red: Get up and running with the Red language for full-stack development;
5. The Full Stack Developer: Your Essential Guide to the Everyday Skills Expected of a Modern Full Stack Web Developer.

Check this interview with senior software developer - https://solveit.dev/blog/how-long-to-learn-web-development

See ya!

Re: C programming (Urgent? Yes.)
Link | by binderrr on 2023-05-29 15:06:21
Hi there! If you're struggling with a computer science homework assignment, I have a great resource for you. Check out codinghomeworkhelp for help with Python homework. They specialize in providing assistance with Python assignments and can guide you through the process step by step. Whether you're facing challenges with coding concepts, syntax, or debugging, their team of experts is ready to lend a hand. With their help, you'll gain a better understanding of Python and be able to tackle your assignment with confidence. Good luck with your assignment!

Back | Reverse | Quick Reply | Post Reply |

Copyright 2000-2024 Gendou | Terms of Use | Page loaded in 0.1732 seconds at 2024-04-17 23:48:47