i want the same character to appear on every line

Write your question here.okay, so the teacher gave us an assignment. in a certain part of it, she asks us that a prompt “>” should be printed for the user and the program waits for the user’s commands. so on each line this prompt must appear before the user starts entering his commands. is there some kind of loop i can use ? and we are limited with for,while,do/while repetition structures.


Every time you're waiting for the user's input, do this first:
cout ">";
Is this what you mean?

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

using namespace std;

int main()
{
    int x,y=2;
    while (y != 1){
        cout << "> ";
        cin >> x;
    }
}

SimonB yes that is it. Thank you very much. i just need to adjust a couple of things and it wil work :)
Topic archived. No new replies allowed.