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

Recommended Answers

All 3 Replies

Well what have you got written so far? We don't do homework for others!

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

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;
}
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.