Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //I was just playing around with c++ and tried to return a string in a function. This is the way I did it!
- //Also do you recognize that you don't need the #include <string>? <iostream> is nice and includes strings aswell.
- //But it's always important and necessary to #include <string> when you're using the string data type!!!(WARNING!)
- #include <iostream>
- using namespace std;
- string helloworld(string text)
- {
- return text;
- }
- int main()
- {
- string function1 = helloworld("Hello World!");
- cout << function1 << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement