A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

C Programming

1.2k views · started by helldana ·
#1
C Programming
Kinda found a solution to my problem, so closed.
#2
I could show you in java, I'm not familiar enough with how c does pointers though.
#3
Kingz V wrote:
I could show you in java, I'm not familiar enough with how c does pointers though.


What he said.

I hate to admit it but I'm not adept enough in C to actually solve this entirely. But I could do something like this in another language like Lua, AutoIt, or Delphi.
#4
Oh darn, I'm only good at C and C++. I haven't tried other languages. ;C

But could you guys maybe, in an English language way of trying to explain what you guys would do? :C
#5
helldana wrote:
Oh darn, I'm only good at C and C++. I haven't tried other languages. ;C

But could you guys maybe, in an English language way of trying to explain what you guys would do? :C


If you're familiar I would use an oop approach.

using a class for the customer using getter/setter methods to store the data.

then the second class would use the customer model and do the math and file formatting.
#6
C doesn't use classes. Only structs.
#7
C doesn't use classes. Only structs.


So as to what Kingz suggested, I should use a structure and then do the math and file processing?

I was wondering though at first, how do you really record the customer's information? Do I need to make my own file of the customer or can the customer input it themselves?
#8
The specs seem to lead to the assumption of having them input and storing the customer data in a struct.
#9
Kingz V wrote:
The specs seem to lead to the assumption of having them input and storing the customer data in a struct.


So afterwards I keep these data obtained into a text file right? But then how do you know the duration of calls they made? And the question even specifically asked to calculate the rates according to the time of day, which confused me even more. ;C
#10
helldana wrote:
Hi I have an assignment at hand I need help from you guys if possible.

Hence, the program should focus on the topics below
i. Array
ii. Pointer
iii. Basic data structures
iv. File processing

Would appreciate it if someone can guide me step by step on how to do this.
I can't seem to think of a way on how to record the customer's information and then calculating the rates since how is it even possible to know the duration?

This is a pretty cool one.
So first of all, could you provide us with the official documentation your class gives you on the project?

You can record the customer information through using iostream for basic console input and output, or you could use file processing to enter a user's information (such as call duration and dates) in a file and then read it from the file.

I would recommend using basic input and output functionality.

I'd organized this program like a control panel.

Ask for the user's name and personal information (the stuff it shows in the sample) and then ask for how many calls they made, on which days, at what time, and how long they called for.

Then do some calculations to figure out the rates and finally store ALL that information in a neatly formatted text file.

I'd recommend using proper variable scoping for this one.
#11
Isonyx wrote:
This is a pretty cool one.
So first of all, could you provide us with the official documentation your class gives you on the project?

You can record the customer information through using iostream for basic console input and output, or you could use file processing to enter a user's information (such as call duration and dates) in a file and then read it from the file.

I would recommend using basic input and output functionality.

I'd organized this program like a control panel.

Ask for the user's name and personal information (the stuff it shows in the sample) and then ask for how many calls they made, on which days, at what time, and how long they called for.

Then do some calculations to figure out the rates and finally store ALL that information in a neatly formatted text file.

I'd recommend using proper variable scoping for this one.


So basically the user will be asked on how many calls/days/time/duration right? Could you give me an coding example on how you'd do it? :C
#12
helldana wrote:
Here's the document. https://www.mediafire.com/?rwnvpu314r6y93g

So basically the user will be asked on how many calls/days/time/duration right? Could you give me an coding example on how you'd do it? :C


I don't really have the time to code the program.
But yeah, you could do it that way.

A few things when calculating charges.


  1. The Phone Rental will always be charged.

  2. When it talks about "different operators" I'm not quite sure what it's referring to.

  3. Allow the user to choose 1G or 4G when setting up user options.

  4. At some point before calculating the charges figure out whether the user is charging on the 0700 to 1900 section or the 1901 to 0659 section. Then use those two options.


Also with user configuration options you'll also need to read the user's call time (which looks to be logged in...military time) AND the duration.

If you can't wrap your head around the coding behind basic input and output you're going to have some problems.

All in all, it'll just take a little bit of time. Ask us if you need help with a specific topic and we can recommend some techniques.

You can start with this Simple I/O tutorial.

And here's one on file processing.
#13
Isonyx wrote:
I don't really have the time to code the program.
But yeah, you could do it that way.

A few things when calculating charges.


  1. The Phone Rental will always be charged.

  2. When it talks about "different operators" I'm not quite sure what it's referring to.

  3. Allow the user to choose 1G or 4G when setting up user options.

  4. At some point before calculating the charges figure out whether the user is charging on the 0700 to 1900 section or the 1901 to 0659 section. Then use those two options.


Also with user configuration options you'll also need to read the user's call time (which looks to be logged in...military time) AND the duration.

If you can't wrap your head around the coding behind basic input and output you're going to have some problems.

All in all, it'll just take a little bit of time. Ask us if you need help with a specific topic and we can recommend some techniques.

You can start with this Simple I/O tutorial.

And here's one on file processing.


The part where it said to different operators is like to a different telecommunication company(or sumthin like that).
Eg. AT&T to Verizon.

Should I ask the user to input the time he/she makes the call and the duration of it?
And yes I'm pretty adept at input/output.
#14
helldana wrote:
The part where it said to different operators is like to a different telecommunication company(or sumthin like that).
Eg. AT&T to Verizon.

Should I ask the user to input the time he/she makes the call and the duration of it?
And yes I'm pretty adept at input/output.


I see, I'm assuming you're just going to choose both same & different for both like in the example.

And yes, but if you have any specific questions like that you might want to talk to your instructor for clarification.
#15
Isonyx wrote:
I see, I'm assuming you're just going to choose both same & different for both like in the example.

And yes, but if you have any specific questions like that you might want to talk to your instructor for clarification.


Okay, but if I manage to make the program later, will it be okay if I ask you to review the source code? :C
#16
helldana wrote:
Oh darn, I'm only good at C and C++. I haven't tried other languages. ;C

But could you guys maybe, in an English language way of trying to explain what you guys would do? :C


How do you learn C++ and be good at it because im taking my diploma course and it requires me to learn C++ my course is information technology for advanced i have to learn java... i heard its hard
#17
marc2 wrote:
How do you learn C++ and be good at it because im taking my diploma course and it requires me to learn C++ my course is information technology for advanced i have to learn java... i heard its hard

I don't know, C++ was practically easy for me, I think it was just in me to be able to do it. ;C
Just practice and learn other people's code to be honest.

I haven't learned Java though, but I'll be learning it in my 2nd year I think.