[HELP] Choose where to write in console

closed account (4i67ko23)
Hi all,
I made a simple menu:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>

using namespace std;
int main( )
{
    printf("################################################################################");
    printf("# Tool v1.2                                                                    #");
    printf("# Copyright 2012 - 2013                                                        #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("################################################################################");
    printf("# Choose a option...                                                           #");
    printf("# 1) Option 1                                                                  #");
    printf("# 2) Option 2                                                                  #");
    printf("# 3) Option 3                                                                  #");
    printf("# 4) Option 4                                                                  #");
    printf("# 5) Help                                                                      #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("################################################################################");
    printf("# Choose:                                                                      #");
    printf("# <input here>                                                                 #");
    printf("################################################################################");
    cin.get();
}

now I want that the input (Where the person can see what he's writing) is at <input>

I have no idee how I can make this.. Can you help me?
Last edited on
noticing that you are in a windows environment, I would say find a function that allows you to position the curser, or use an external library.
closed account (4i67ko23)
Can you give me a example?
closed account (4i67ko23)
I found this: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686025%28v=vs.85%29.aspx
Only I don't now how to use it.
I haven't worked with the Windows.h library, but I looked at the link you gave and here is what I could manage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <Windows.h>

int main()
{
    int num;

    HANDLE stdHandle;
    CONSOLE_SCREEN_BUFFER_INFO buffInfo;
    buffInfo.dwCursorPosition.X = 20; 
    buffInfo.dwCursorPosition.Y = 20;

    stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
    std::cout << "Enter something: " << std::endl;    

    SetConsoleCursorPosition(stdHandle, buffInfo.dwCursorPosition);

    std::cin >> num;

    std::cin.get();    
}
closed account (4i67ko23)
how can I build this in my code?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>

using namespace std;
int main( )
{
    printf("################################################################################");
    printf("# Tool v1.2                                                                    #");
    printf("# Copyright 2012 - 2013                                                        #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("################################################################################");
    printf("# Choose a option...                                                           #");
    printf("# 1) Option 1                                                                  #");
    printf("# 2) Option 2                                                                  #");
    printf("# 3) Option 3                                                                  #");
    printf("# 4) Option 4                                                                  #");
    printf("# 5) Help                                                                      #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("#                                                                              #");
    printf("################################################################################");
    printf("# Choose:                                                                      #");
    printf("# <input here>                                                                 #");
    printf("################################################################################");
    cin.get();
}
You will get more help, on windows specific topics, if you move your topic to the the "windows" section.
closed account (4i67ko23)
Ok, I will repost it
Do not repost, just move the topic
from my opinion, instead trying to make this on console, why don't you try to make it on windows program?
closed account (4i67ko23)
Creating the program in a window sounds very hard to me. I will try that when I've more experience.
Topic archived. No new replies allowed.