getline

I've seen getline used with a string from a cin statement. Is it possible for me to use getline with a cout statement?

cout << "Roll #"<<roll<<endl;
if (hold1=='y' || hold1=='Y')
{
cout<<"Dice 1: "<<getline(cout,die1);
}
Maybe...I don't think it would be wise though, because cout is being outputted to the screen and will probably never contain anything, thus halting the program forever.
If hold1=='n' wouldn't it just skip over that and go to my else which defined die1 to show a random number. The point of this is to choose whether to display a random number or get that specific random number from a previous iteration. Like in yahtzee when I want to hold certain dice but continue to roll the rest.
Well....yes, but getline(cout, die1) would still freeze (probably) if you got to that line of code.
Is it a syntax thing? I'm not quite sure if I'm using the correct format. When I try to run my program it gives me this error cpp(43) : error C3861: 'getline': identifier not found.
Topic archived. No new replies allowed.