Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Can someone help me with C++ functions?
New Posts  All Forums:Forum Nav:

Can someone help me with C++ functions?

post #1 of 4
Thread Starter 
Hey guys i'm a noob at this and would like to get some help with functions. I'm still trying to learn this as it is a little confusing. My instructions from my professor was this...
  • Input: This is the data for the month of January. Enter your input in the main function.
  • processing calculation: New balance = inventory balance at the beginning of the month + number of copies received during the month - number of copies sold during the month

Now i Have the data here apparently is too long so i will not post...but to give you an idea this is my pseudocode (is this right or wrong?)

Start function main
Call function inputData // This is where January Data will be going to.
Call function calcNewBalance // This is where i will calculate new balance
Call function displayOutput // this is where i'll display the old and new data
return
End function main

Start function inputData
Prompt user to enter January Data
Input January Data
return JanData
End function inputData

Start function calcNewBalance
Calculate new balance for inventory
return newBalance
End function calcNewBalance

Start function displayOutput
Display JanData
Display newBalance
End function displayOutput

she wants the input of the data in the main function? Do i have my pseudocode layed out correctly? or did i mess this up completely?
overclocking toy
(13 items)
 
  
CPUMotherboardGraphicsRAM
I7-950 Asus P6TD Deluxe MSI GTX 560 TI Corsair XMS3 12gb DDR3 
Hard DriveOptical DriveOSMonitor
1.5 TB @7200 RPM Blu-Ray/DVD/CD + Burner Windows 7 Asus 27" LED 
PowerCase
Corsair HX 850 Coolermaster HAF 932 
  hide details  
Reply
overclocking toy
(13 items)
 
  
CPUMotherboardGraphicsRAM
I7-950 Asus P6TD Deluxe MSI GTX 560 TI Corsair XMS3 12gb DDR3 
Hard DriveOptical DriveOSMonitor
1.5 TB @7200 RPM Blu-Ray/DVD/CD + Burner Windows 7 Asus 27" LED 
PowerCase
Corsair HX 850 Coolermaster HAF 932 
  hide details  
Reply
post #2 of 4
Well, is she asking that the input be entered through the main function and passed to another function to calculate? If so, then you probably want to get rid of the separate inputData function.

You can post the code in [code] tags, can't you?
Intellect v2
(9 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC... 
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5 
Mouse
MIONIX NAOS 7000 
  hide details  
Reply
Intellect v2
(9 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7-6700K Processor ASUS ROG MAXIMUS VIII HERO LGA1151 DDR4 M.2 SAT... EVGA GTX 1080 SC ACX 3.0 Crucial Ballistix Sport 32GB DDR4 2400 MT/s (PC... 
CoolingKeyboardPowerCase
Noctua NH-D15 Das Keyboard 4 Professional (Brown) Corsair AX860 Fractal Design Define R5 
Mouse
MIONIX NAOS 7000 
  hide details  
Reply
post #3 of 4
Yeah what Plex said. From what it sounds like, the teacher didn't want the input of the data in a separate function but in the main function. But the general layout looks good. I'm just assuming that when those functions are called, the return result will be placed into a variable. If so, you are golden.
post #4 of 4
Thread Starter 
Sweeeeeeet thanks guys...!!! So all i need to do is just make a few adjustments and just start coding...Also, yes these will placed into variables once i start the source code.

Rep+ for both
overclocking toy
(13 items)
 
  
CPUMotherboardGraphicsRAM
I7-950 Asus P6TD Deluxe MSI GTX 560 TI Corsair XMS3 12gb DDR3 
Hard DriveOptical DriveOSMonitor
1.5 TB @7200 RPM Blu-Ray/DVD/CD + Burner Windows 7 Asus 27" LED 
PowerCase
Corsair HX 850 Coolermaster HAF 932 
  hide details  
Reply
overclocking toy
(13 items)
 
  
CPUMotherboardGraphicsRAM
I7-950 Asus P6TD Deluxe MSI GTX 560 TI Corsair XMS3 12gb DDR3 
Hard DriveOptical DriveOSMonitor
1.5 TB @7200 RPM Blu-Ray/DVD/CD + Burner Windows 7 Asus 27" LED 
PowerCase
Corsair HX 850 Coolermaster HAF 932 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Can someone help me with C++ functions?