View Single Post
  #2 (permalink)  
Old 09-14-2008, 12:10 PM
erabyss erabyss is offline
Newbie
 
Join Date: Sep 2008
Posts: 6
Credits: 0
Rep Power: 0
erabyss is on a distinguished road
Default Re: Funtion prototypes

I think I got it. -code posted below-

If you know of a way to better write this piece of code, please share it with me. Thank you.

--------------------------------------
Code:
#include <iostream>
#include <string>

using namespace std;

string reply; 
string answer; // kangaroo rnaooagk
string word;
string word2;
string question(string word, string answer);

int main()
{
    string word2 = question("rnaooagk", "kangaroo");
    cin.get();
}

string question(string word, string answer)
{
    do
    {
     cout <<"Unscramble the word: "<< word << "\n";
cin >> reply;
    } while (reply != answer);
    return reply;
}

Last edited by WingedPanther; 09-14-2008 at 01:59 PM. Reason: add code tags
Reply With Quote