uber c++ noob needing simple code

Hello, I am very new to the whole C++ concept and am just trying to write a simple program. All I need is this:

-repeatedly ask the user for a number between 1 and 10
-if the user complies, thank them, and ask again.
-on error, outline the terminal screen in ! and display a big red error message in the center. Something like:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! !!
!! !!
!! !!
!! ERROR!!! !!
!! Can't you follow instructions? !!
!! Now enter a number between 1 and 10!: !!
!! !!
!! !!
!! !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


I know how to ask the user for numbers and to thank the user and ask again. The part I have trouble with is getting the rectangle with text to appear in an 80x24 terminal. If someone could help out with some just this part I would appreciate it.

Thanks


 
//My code is so error-filled I won't bother posting it yet lol 
Just line it up manually and print it as one huge string.

Edit: Separate the string by line so that you can indent freely.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example program
#include <iostream>
#include <string>

int main()
{
    std::string output =    
    "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
    "!!                                                             !!\n"
    "!!                                                             !!\n"
    "!!                                                             !!\n"
    "!!                         ERROR!!!                            !!\n"
    "!!              Can't you follow instructions?                 !!\n"
    "!!          Now enter a number between 1 and 10!:              !!\n"
    "!!                                                             !!\n"
    "!!                                                             !!\n"
    "!!                                                             !!\n"
    "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";

    std::cout << output << std::endl;

}
Last edited on
Thanks! Works like a charm..can't believe I didn't think of this!
Topic archived. No new replies allowed.