#### Archived

This topic is now archived and is closed to further replies.

# NEED HELP with my Function !!!

This topic is 6186 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I need desperate help with solving a function problem that is stressing me out. How do you return an increment value from a function back into the main? Here''s a sample: #include #include void process_deposits (double, double, int, double); void process_deposits (double new_bal, double amount, int n_dep, double total_dep) { cout << "Enter the deposit amount : $"; cin >> amount; new_bal += amount; ++n_dep; total_dep += amount; cout << "New balance :$ " << new_bal << " "; } int main (void) { while (tranx_type != ''Q'' && tranx_type != ''q'') { if (tranx_type == ''D'' || tranx_type == ''d'') { process_deposits (new_bal, amount, n_dep, total_dep); } else if (tranx_type == ''Q'' || tranx_type == ''q'') { cout << n_dep << " Deposits Totaling \$ " << setw(8) << total_dep << "\n"; } }

##### Share on other sites
 ` #include int f(void) //return type is int{ int i; cout<<"\nEnter integer: "; cin>>i; return ++i; //return value to calling function} int main(void){ cout<

HTH

Edited by - Clash Rocker on August 8, 2001 2:14:27 PM

1. 1
2. 2
Rutin
19
3. 3
JoeJ
16
4. 4
5. 5

• 30
• 22
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631700
• Total Posts
3001800
×