User Created functions

0 LaV Brown · August 1, 2015
I have a project that wants user-created functions for entering data ( two different functions for two different cin items) and then using what was entered via those functions in another function that uses that data for calculations and pulls variables from an array to also use in calculations. How do you make all that work? How do you use data created in one function to be used in another function?

Post a Reply

Replies

Oldest  Newest  Rating
0 Superman HC · August 2, 2015
there comes the role of return keyword... 
public int getValue(){
 ///// code
return value;
}

main(){
 int x = getValue();
}

// same for anothr function...
0 Franz Schmidt · August 3, 2015
Or you use global variables but i always prefer Ravi's way
  • 1

C++

107,032 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator