0

how can I place all of my program in a while loop
what I want is this:
the user should enter color of pen ,color of brush and then enter name of a shape that want to draw.
my program should give this information and draw a shape
the user have this permission not to enter something as color of pen or brush.
if he doesn't enter something as pencolor or penbrush my program should have default.
my problem is this:
my program can't give 2 string and then do its task.
i mean my program should do :cin.getline(strsentence)
and do some tasks(for example change the color of pen)
and then cin.getline(strsentence)
this time strsentence is circle(x,y,r)
the program should draw a circle with entered coordinate
but it can't do this task
pleasse help me

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by Nedals
0

I don't want you to do my homework.
I just want to know if I can place all of a program in a while loop .
please tell me yes or no.
I tried a lot but couldn 't find a good condition to break the loop

0
int main() {
  do {
    ...
    your code
    ...
  } while (not some exit condition);
  return 0;
}

OR

int main() {
  while (1) {
    ...
    your code
    ...
    if (some exit condition) { break; }
  }
  return 0;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.