i got a problem on get data from other function,
i know can use a return... but i forgotten how to code the return....
can show me a example of source code ?

void main(){
perform data()
//how can i get the "name" from data function??
}
int data(){
read name
}

E.g. To add two numbers and print answer to screen

#include <iostream>

using namespace std;

int addnums(int number1, int number2)
{
int answer = number1 + number2;
return answer;
}

int main()
{
int num1 = 1;
int num2 = 2;
cout << addnums(num1,num2);
}

e.g say you wanted to store that answer away, you could recode it to be like:

int answer = addnums(num1,num2);

or if you wanted to check something

if (addnums(num1,num2) > 9)
{
cout << "the answer is greater than 9!";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.