we are starting to learn about functions now and we have a simple function that we have to do. i was looking through my book, but all the examples were using int and not string (which is what i think i need).
the description of the problem is: Write a function called myName which returns (does not cout) your full name (e.g., "Bob Smith"). Write main to call the function and display the name on the screen. NOTE: Your name should not appear anywhere other than in the function myName.
so far i have something looking like this:
i know this is a very short and simple program but im not sure if im on the right track.Code:#include <iostream> #include <string> using namespace std; string myName() { return "users name"; } int main() { myName; }
thanks for the help.



LinkBack URL
About LinkBacks



