I'm writing a c++ program for a class I'm taking. I'm having a problem getting the string variable into the void print_results function. Basically, at the beginning of the main function, I ask the user for their name. I can use the name variable in the main function and it works fine, but I have to display all the results in a void print_results function, and I'm not quite sure how to get a string type variable into that function. I'm using Visual Studio .net. I initialialize it in main-String *name. I've looked in my book, and notes, but no info on it. If anyone could help me out a bit, by telling me how to put strings into the function call, that'd be great.
Thanks in advance
Jay
jayrads
0
Newbie Poster
Recommended Answers
Jump to Post#include <iostream> using namespace std; void Print(); int main() { Print(); } void Print() { char Name[] //Your code }
If I understand what you asked right...
Jump to PostHi,
It wud be really good if you can post your program. Are you getting problem when you are trying to pass the variable from main to print_results function ?cheers,
aj.wh.ca
All 6 Replies
Raven11
0
Light Poster
aj.wh.ca
0
Junior Poster in Training
Raven11
0
Light Poster
jayrads
0
Newbie Poster
aj.wh.ca
0
Junior Poster in Training
jayrads
0
Newbie Poster
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.