//clrscr.h

#pragma once

#include <windows.h>
#include <iostream>
#include <conio.h>
using namespace std;

void clrscr()
{
  COORD coordScreen = { 0, 0 };
  DWORD cCharsWritten;
  CONSOLE_SCREEN_BUFFER_INFO csbi;
  DWORD dwConSize;
  HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

  GetConsoleScreenBufferInfo(hConsole, &csbi);
  dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
  FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
  GetConsoleScreenBufferInfo(hConsole, &csbi);
  FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen,
&cCharsWritten);
  SetConsoleCursorPosition(hConsole, coordScreen);
}
#include <clrscr.h>
using namespace std;

int main(){
     cout<<"Animesh";
     clrscr();
     return 0;
     _getch();
}

When I run the above .cpp file in the 'Compiler' window I get a msg.

[Warning] no newline at end of file

Therefore, I am getting the wrong output .... please help ...... !!!
:)

Recommended Answers

All 2 Replies

Its just a warning, goto the last line of the file and press enter.

Oooook .....
Got it ....
Thanx.....
:D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.