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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// Plotting.cpp : Defines the entry point for the console application.
//
#include <stdafx.h>
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
COORD CursorPosition;
void gotoXY(int x, int y)
{
CursorPosition.X = x;
CursorPosition.Y = y;
SetConsoleCursorPosition(console,CursorPosition);
}
void gotoXY(int x, int y, string text)
{
CursorPosition.X = x;
CursorPosition.Y = y;
SetConsoleCursorPosition(console,CursorPosition);
cout << text;
}
void WaitKey()
{
while (_kbhit()) _getch(); // Empty the input buffer
_getch(); // Wait for a key
while (_kbhit()) _getch(); // Empty the input buffer
// ( some keys sends two messages)
}
int main(int)
{
int x[] = {0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90};
int y[] = {0,7,11,14,11,10, 9, 9, 9,10,10,11,11,10, 9, 9};
string line(80,'_');
for ( int a = 0; a < 14; a++)
{
gotoXY(x[a],y[a],"$");
gotoXY(x[a],16);
cout << a+1;
}
gotoXY(0,15,line);
gotoXY(0,25);
WaitKey();
return 0;
}
|