My Console is Messed up

I really need help, I need to finish this assignment before tomorrow.

My code is too long so i will post what is the problem

EDIT The problem is when I am waiting for input or keypress after I do \n or cout << endl; if you resize window the cursor will move and everything will disappear to nowhere

http://textuploader.com/ddjdu



How to avoid this?
Last edited on
My code is too long so i will post what is the problem

Please use this website :
http://textuploader.com/

Paste your whole code and paste the link here so that everyone can see.
Hi thanks for reply, i post a part of code where the problem starts.

http://textuploader.com/ddjai

Right after the first cout << endl and when waiting for input, if i resize window cursor will not stay still
If I can't compile the program you are having, people will likely have a hard time fixing your problem.
Sorry i forgot that,

http://textuploader.com/ddjdu

I put what was need on main. You will have to put wrong input and then when you see cursor blinking, maximize console window or resize and everything will mess up
Last edited on
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
36
37
// x is the column, y is the row. The origin (0,0) is top-left.
void Consola::setCursorPosition(int x, int y)
{
	static const HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	std::cout.flush();
	COORD coord = { (SHORT)x, (SHORT)y };
	SetConsoleCursorPosition(hOut, coord);

}

void Consola::setCursorPosition(COORD coord)
{
	static const HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	std::cout.flush();
	SetConsoleCursorPosition(hOut, coord);

}

COORD Consola::GetConsoleCursorPosition()
{
	static const HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

	COORD coord;

	CONSOLE_SCREEN_BUFFER_INFO cbsi;
	if (GetConsoleScreenBufferInfo(hOut, &cbsi))
	{
		coord = cbsi.dwCursorPosition;
		return coord;
	}
	else
	{
		// The function failed. Call GetLastError() for details.
		COORD invalid = { 0, 0 };
		return invalid;
	}
}

I don't see you use these functions in your program. You should apply these functions and tell us the function you are having so that we can fix it.
Sorry I edited, the problem is not with console cursor position functions, i had to verify many times to see where it happened again
Last edited on
This is program written in a foreign language. Can you quickly describe the purpose of this program?
It's a program to print some values into a sin function and show it on screen, this is just the main menu and this problem with window resizing messes up the output on console if user resizes window
Topic archived. No new replies allowed.