xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create and call a function with return type in C++
C++ Online Editor
Execute Code
More C++ Sample Code
#include <iostream> #include <string> using namespace std; // use std namespace to avoid std:: before cout // Function declarations string MethodReturnString(); int MethodReturnInteger(); int main() { // Return string data string returnStringValue = MethodReturnString(); cout << returnStringValue << endl; // Return integer data int returnIntegerValue = MethodReturnInteger(); cout << "This method returns integer: " << returnIntegerValue << endl; return 0; } // Method to return a string type data string MethodReturnString() { return "This method returns string data."; } // Method to return an integer type data int MethodReturnInteger() { return 10 + 11; }