There's no platform independent way of doing that but since you mentioned system('cls')
I assume you are on Windows.
Windows has the Console Functions API which is a set of utility functions used for manipulating the console. You have 2 options here:
Set the cursor's position and overwrite it with spaces:
#include <windows.h>
..
auto consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coordsToDelete = { row, col }; // the coordinates of what you want to delete
// Move the current cursor position back. Writing with std::cout will
// now print on those coordinates
::SetConsoleCursorPosition(consoleHandle, position);
// This will replace the character at (row, col) with space.
// Repeat as many times as you need to clear the line
std::cout << " ";
Alternatively, you can get the entire console buffer and directly modify it:
#include <windows.h>
..
auto consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
// Get a handle to the console buffer
GetConsoleScreenBufferInfo(consoleHandle, &csbi));
DWORD count;
COORD coords = { row, 0 };
DWORD cellCount = /* the length of your row */;
// Write the whitespace character to the coordinates in cellCount number of cells
// starting from coords. This effectively erases whatever has been written in those cells
FillConsoleOutputCharacter(
consoleHandle,
(TCHAR) ' ',
cellCount,
coords,
&count);