|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
A tutti i programmatori di C++ .Urgente !!!
Tenete presente la funzione gotoxy del Pascal o del C che serve a posizionarsi su un punto dello schermo ? Bene utilizzo Visual C++ . Net e tale funzione non riesco a trovarla . Nelle altre versioni era presente nella conio.h ma questa volta no . Infatti nonostante la includi gotoxy non sà proprio di cosa si tratti . Per favore aiutatemi . Grazie .
|
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Purtroppo è ancora un mistero... Non sono riuscito a trovarla...
|
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
gotoxy non è una funzione standard e per questo non c'è (anche nel 6 non c'è)...
Una cosa che ci si avvicina molto è questa... Codice:
#include <windows.h>
void NewLine(void);
void ScrollScreenBuffer(HANDLE, INT);
HANDLE hStdout, hStdin;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
void main(void)
{
LPSTR lpszPrompt1 = "Type a line and press Enter, or q to quit: ";
LPSTR lpszPrompt2 = "Type any key, or q to quit: ";
CHAR chBuffer[256];
DWORD cRead, cWritten, fdwMode, fdwOldMode;
WORD wOldColorAttrs;
// Get handles to STDIN and STDOUT.
hStdin = GetStdHandle(STD_INPUT_HANDLE);
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE)
{
MessageBox(NULL, "GetStdHandle", "Console Error", MB_OK);
return;
}
// Save the current text colors.
if (! GetConsoleScreenBufferInfo(hStdout, &csbiInfo))
{
MessageBox(NULL, "GetConsoleScreenBufferInfo", "Console Error", MB_OK);
return;
}
wOldColorAttrs = csbiInfo.wAttributes;
// Set the text attributes to draw red text on black background.
if (! SetConsoleTextAttribute(hStdout, FOREGROUND_RED|FOREGROUND_INTENSITY))
{
MessageBox(NULL, "SetConsoleTextAttribute", "Console Error", MB_OK);
return;
}
// Write to STDOUT and read from STDIN by using the default
// modes. Input is echoed automatically, and ReadFile
// does not return until a carriage return is typed.
//
// The default input modes are line, processed, and echo.
// The default output modes are processed and wrap at EOL.
while (1)
{
if (! WriteFile(
hStdout, // output handle
lpszPrompt1, // prompt string
lstrlen(lpszPrompt1), // string length
&cWritten, // bytes written
NULL) ) // not overlapped
{
MessageBox(NULL, "WriteFile", "Console Error", MB_OK);
return;
}
if (! ReadFile(
hStdin, // input handle
chBuffer, // buffer to read into
255, // size of buffer
&cRead, // actual bytes read
NULL) ) // not overlapped
break;
if (chBuffer[0] == 'q') break;
}
// Turn off the line input mode, and echo the input mode.
if (! GetConsoleMode(hStdin, &fdwOldMode))
{
MessageBox(NULL, "GetConsoleMode", "Console Error", MB_OK);
return;
}
fdwMode = fdwOldMode &
~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
if (! SetConsoleMode(hStdin, fdwMode))
{
MessageBox(NULL, "SetConsoleMode", "Console Error", MB_OK);
return;
}
// Without line and echo input modes, ReadFile returns
// when any input is available. Carriage returns must
// be handled, and WriteFile is used to echo input.
NewLine();
while (1)
{
if (! WriteFile(
hStdout, // output handle
lpszPrompt2, // prompt string
lstrlen(lpszPrompt2), // string length
&cWritten, // bytes written
NULL) ) // not overlapped
{
MessageBox(NULL, "WriteFile", "Console Error", MB_OK);
return;
}
if (! ReadFile(hStdin, chBuffer, 1, &cRead, NULL))
break;
if (chBuffer[0] == '\r')
NewLine();
else if (! WriteFile(hStdout, chBuffer, cRead,
&cWritten, NULL)) break;
else
NewLine();
if (chBuffer[0] == 'q') break;
}
// Restore the original console mode.
SetConsoleMode(hStdin, fdwOldMode);
// Restore the original text colors.
SetConsoleTextAttribute(hStdout, wOldColorAttrs);
}
// The NewLine function handles carriage returns when the processed
// input mode is disabled. It gets the current cursor position
// and resets it to the first cell of the next row.
void NewLine(void)
{
if (! GetConsoleScreenBufferInfo(hStdout, &csbiInfo))
{
MessageBox(NULL, "GetConsoleScreenBufferInfo", "Console Error", MB_OK);
return;
}
csbiInfo.dwCursorPosition.X = 0; //prova a mettere 10 qui e vedi
// If it is the last line in the screen buffer, scroll
// the buffer up.
if ((csbiInfo.dwSize.Y-1) == csbiInfo.dwCursorPosition.Y)
{
ScrollScreenBuffer(hStdout, 1);
}
// Otherwise, advance the cursor to the next line.
else csbiInfo.dwCursorPosition.Y += 1;
if (! SetConsoleCursorPosition(hStdout,
csbiInfo.dwCursorPosition))
{
MessageBox(NULL, "SetConsoleCursorPosition", "Console Error", MB_OK);
return;
}
}
void ScrollScreenBuffer(HANDLE h, INT x)
{
SMALL_RECT srctScrollRect, srctClipRect;
CHAR_INFO chiFill;
COORD coordDest;
srctScrollRect.Left = 0;
srctScrollRect.Top = 1;
srctScrollRect.Right = csbiInfo.dwSize.X - x;
srctScrollRect.Bottom = csbiInfo.dwSize.Y - x;
// The destination for the scroll rectangle is one row up.
coordDest.X = 0;
coordDest.Y = 0;
// The clipping rectangle is the same as the scrolling rectangle.
// The destination row is left unchanged.
srctClipRect = srctScrollRect;
// Set the fill character and attributes.
chiFill.Attributes = FOREGROUND_RED|FOREGROUND_INTENSITY;
chiFill.Char.AsciiChar = ' ';
// Scroll up one line.
ScrollConsoleScreenBuffer(
h, // screen buffer handle
&srctScrollRect, // scrolling rectangle
&srctClipRect, // clipping rectangle
coordDest, // top left destination cell
&chiFill); // fill character and color
}
|
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Rielaborandola un po'...
Codice:
#include <windows.h>
void gotoxy(int, int);
HANDLE hStdout, hStdin;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
void main(void)
{
DWORD cWritten, fdwMode, fdwOldMode;
WORD wOldColorAttrs;
// Get handles to STDIN and STDOUT.
hStdin = GetStdHandle(STD_INPUT_HANDLE);
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE)
{
MessageBox(NULL, "GetStdHandle", "Console Error", MB_OK);
return;
}
// Save the current text colors.
if (! GetConsoleScreenBufferInfo(hStdout, &csbiInfo))
{
MessageBox(NULL, "GetConsoleScreenBufferInfo", "Console Error", MB_OK);
return;
}
wOldColorAttrs = csbiInfo.wAttributes;
// Set the text attributes to draw red text on black background.
if (! SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN|FOREGROUND_INTENSITY))
{
MessageBox(NULL, "SetConsoleTextAttribute", "Console Error", MB_OK);
return;
}
// Turn off the line input mode, and echo the input mode.
if (! GetConsoleMode(hStdin, &fdwOldMode))
{
MessageBox(NULL, "GetConsoleMode", "Console Error", MB_OK);
return;
}
fdwMode = fdwOldMode &
~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
if (! SetConsoleMode(hStdin, fdwMode))
{
MessageBox(NULL, "SetConsoleMode", "Console Error", MB_OK);
return;
}
// Without line and echo input modes, ReadFile returns
// when any input is available. Carriage returns must
// be handled, and WriteFile is used to echo input.
LPSTR lpszPrompt1 = "Type a line and press Enter, or q to quit: ";
gotoxy(10, 5);
if (! WriteFile(
hStdout, // output handle
lpszPrompt1, // prompt string
lstrlen(lpszPrompt1), // string length
&cWritten, // bytes written
NULL) ) // not overlapped
{
MessageBox(NULL, "WriteFile", "Console Error", MB_OK);
return;
}
gotoxy(17, 12);
if (! WriteFile(
hStdout, // output handle
lpszPrompt1, // prompt string
lstrlen(lpszPrompt1), // string length
&cWritten, // bytes written
NULL) ) // not overlapped
{
MessageBox(NULL, "WriteFile", "Console Error", MB_OK);
return;
}
// Restore the original console mode.
SetConsoleMode(hStdin, fdwOldMode);
// Restore the original text colors.
SetConsoleTextAttribute(hStdout, wOldColorAttrs);
}
// The NewLine function handles carriage returns when the processed
// input mode is disabled. It gets the current cursor position
// and resets it to the first cell of the next row.
void gotoxy(int x, int y)
{
if (! GetConsoleScreenBufferInfo(hStdout, &csbiInfo))
{
MessageBox(NULL, "GetConsoleScreenBufferInfo", "Console Error", MB_OK);
return;
}
csbiInfo.dwCursorPosition.X = x;
csbiInfo.dwCursorPosition.Y = y;
if (! SetConsoleCursorPosition(hStdout,
csbiInfo.dwCursorPosition))
{
MessageBox(NULL, "SetConsoleCursorPosition", "Console Error", MB_OK);
return;
}
}
Comunque volendo puoi crearti una classe che serializza i vari tipi di input e li scrive con la WriteFile... |
|
|
|
|
|
#5 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Se ti serve mi sono fatto qualche classe di supporto per inpute e output :
Codice:
#include <windows.h>
#include <iostream.h>
class Con_base
{
protected:
static HANDLE hStdout, hStdin;
static DWORD fdwMode, fdwOldMode;
static BOOL firstRun;
static WORD wOldColorAttrs;
DWORD read(void *buf, DWORD size);
BOOL print(const void *buf, const DWORD size);
public:
BOOL GotoXY(int x, int y);
BOOL TextColor(WORD mode);
Con_base();
~Con_base();
};
BOOL Con_base::firstRun = TRUE;
HANDLE Con_base::hStdout = 0;
HANDLE Con_base::hStdin = 0;
DWORD Con_base::fdwMode = 0;
DWORD Con_base::fdwOldMode = 0;
WORD Con_base::wOldColorAttrs = 0;
Con_base::Con_base()
{
if(firstRun)
{
firstRun = FALSE;
hStdin = GetStdHandle(STD_INPUT_HANDLE);
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
if(!GetConsoleScreenBufferInfo(hStdout, &csbiInfo))
{
MessageBox(NULL, "GetConsoleScreenBufferInfo", "Console Error", MB_OK);
return;
}
wOldColorAttrs = csbiInfo.wAttributes;
if(!GetConsoleMode(hStdin, &fdwOldMode))
{
MessageBox(NULL, "GetConsoleMode", "Console Error", MB_OK);
return;
}
fdwMode = fdwOldMode & ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
if(!SetConsoleMode(hStdin, fdwMode))
{
MessageBox(NULL, "SetConsoleMode", "Console Error", MB_OK);
return;
}
if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE)
MessageBox(NULL, "GetStdHandle", "Console Error", MB_OK);
}
}
Con_base::~Con_base()
{
SetConsoleMode(hStdin, fdwOldMode);
SetConsoleTextAttribute(hStdout, wOldColorAttrs);
}
BOOL Con_base::GotoXY(int x, int y)
{
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
if(!GetConsoleScreenBufferInfo(hStdout, &csbiInfo))
return FALSE;
if(x >= csbiInfo.dwSize.X || y >= csbiInfo.dwSize.Y)
return FALSE;
csbiInfo.dwCursorPosition.X = x;
csbiInfo.dwCursorPosition.Y = y;
if(!SetConsoleCursorPosition(hStdout, csbiInfo.dwCursorPosition))
return FALSE;
return TRUE;
}
BOOL Con_base::TextColor(WORD mode)
{
if(!SetConsoleTextAttribute(hStdout, mode))
return FALSE;
return TRUE;
}
BOOL Con_base::print(const void *buf, const DWORD size)
{
DWORD cWritten;
if(!WriteFile(hStdout, buf, size, &cWritten, NULL))
return FALSE;
if(cWritten != size)
return FALSE;
return TRUE;
}
DWORD Con_base::read(void *buf, DWORD size)
{
DWORD cRead;
DWORD pos = 1;
do {
if(!ReadFile(hStdin, ((char *)buf), 1, &cRead, NULL))
return 0;
print(((char *)buf), 1);
} while(isspace(((char *)buf)[0]));
do {
if(!ReadFile(hStdin, ((char *)buf) + pos, 1, &cRead, NULL))
return 0;
if(!isspace(((char *)buf)[pos]))
print(((char *)buf) + pos, 1);
++pos;
} while(!isspace(((char *)buf)[pos-1]) && pos < size);
return pos-1;
}
class ConOut : public Con_base
{
public:
ConOut(){ };
ConOut & operator << (const __int64 w);
ConOut & operator << (const int w);
ConOut & operator << (const char w);
ConOut & operator << (const char *w);
};
ConOut & ConOut::operator << (const __int64 w)
{
char buffer[256];
_i64toa(w, buffer, 10);
print(buffer, strlen(buffer));
return *this;
}
ConOut & ConOut::operator << (const int w)
{
return *this << (__int64)w;
}
ConOut & ConOut::operator << (const char w)
{
print(&w, sizeof(char));
return *this;
}
ConOut & ConOut::operator << (const char *w)
{
print(w, strlen(w));
return *this;
}
#define IN_BUFFER_SIZE 256
class ConIn : public Con_base
{
public:
ConIn(){ };
ConIn & operator >> (__int64 &w);
ConIn & operator >> (int &w);
ConIn & operator >> (char &w);
ConIn & operator >> (char *w);
};
ConIn & ConIn::operator >> (__int64 &w)
{
char buffer[256];
DWORD num = read(buffer, 255);
if(num > 0)
{
buffer[num] = '\0';
w = _atoi64(buffer);
}
return *this;
}
ConIn & ConIn::operator >> (int &w)
{
char buffer[20];
DWORD num = read(buffer, 19);
if(num > 0)
{
buffer[num] = '\0';
w = atoi(buffer);
}
return *this;
}
ConIn & ConIn::operator >> (char &w)
{
read(&w, sizeof(char));
return *this;
}
ConIn & ConIn::operator >> (char *w)
{
char buffer[256];
DWORD num;
if((num = read(buffer, 255)) > 0)
{
buffer[num] = '\0';
strcpy(w, buffer);
}
return *this;
}
void main(void)
{
ConOut out;
ConIn in;
out << 'a' << '<' << 10 ;
out.GotoXY(10, 10);
int a;
in >> a;
out.TextColor(FOREGROUND_BLUE|FOREGROUND_INTENSITY);
out << 'a' << '<' << 10 << ' ' << a;
out.GotoXY(17, 15);
char str[100];
in >> str;
out.TextColor(FOREGROUND_GREEN);
out << "ciao" << "\n\r" << "ciao " << str;
}
|
|
|
|
|
|
#6 |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
Re
Ho incluso l'header con la classe che mi hai fornito : l'ho compilato tutto ok . Guarda un attimo il seguente codice :
void main() { ConIn pippo ; clinica<info_paziente> clinica1; char scelta; do { system("cls"); cout << "+--------------------------------------------------------+\n"; cout << "¦ MENU' PRINCIPALE ¦\n"; cout << "¦--------------------------------------------------------¦\n"; cout << "¦ 1) Aggiunta Paziente ¦\n"; cout << "¦ 2) Ricerca Dati Paziente ¦\n"; cout << "¦ 3) Controlli ¦\n"; cout << "¦ 4) Statistiche ¦\n"; cout << "¦ 5) Uscita Dal Programma ¦\n"; cout << "+--------------------------------------------------------+\n"; cout << '\n'; cout << " Fai la tua scelta : " ; pippo.GotoXY(12,12); cin >> scelta ; switch (scelta) { case '1':{aggiunta(clinica1); };break; case'2':{stampa(clinica1); };break; case'3':{ };break; case'4':{ };break; }; }while (scelta!='5'); }; ho dichiarato l'istanza della classe che gentilmente mi hai fornito . il mio obbiettivo è quello di leggere il carattere in una posizione prefissata dopo la comparsa del messaggio "fai la tua scelta : " ed invece il metodo gotoxy della classe a seconda dei parametri mi sposta la posizione del messaggio e non la posizione del cursore . Come posso fare ? |
|
|
|
|
|
#7 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Devi usare anche ConOut per fare l'output... Come ho già detto non è compatibile con le normali classi di input e output (tu usi cout)...
|
|
|
|
|
|
#8 |
|
Senior Member
Iscritto dal: Apr 2001
Città: Milano
Messaggi: 3736
|
se ti va, per mia curiosità personale, prova questo
#include <windows.h> #include <iostream> using std::cout; using std::endl; int main(int argc, char *argv[]) { COORD coord; coord.X = (short)atol(argv[1]); coord.Y = (short)atol(argv[2]); HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hConsole, coord); cout << "X (" << coord.X << ", " << coord.Y << ")" << endl; return 0; } |
|
|
|
|
|
#9 |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
ho provato
ho provato a fare la lettura e la stampa non con cout e cin ma con le classi che tu mi hai fornito ma non ottengo ciò che speravo . Mi potresti fare un pezzo di codice semplice semplice ? In un file cpp includi la classi che tu mi hai fornito . Dopodiche nella funzione main stampa una serie di messaggi del tipo :
cognome : nome : età : sesso : dopo la stampa di questi messaggi posizionati al fianco di ognuna con la gotoxy e leggi da tastiera . E' questo in realtà ciò che voglio fare . Mi potresti aiutare per cortesia . Sei già stato gentilissimo spero che continuerai ad esserlo . Grazie |
|
|
|
|
|
#10 | |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
Quote:
Potresti spiegarmi questo codice cortesemente ? |
|
|
|
|
|
|
#11 |
|
Senior Member
Iscritto dal: Apr 2001
Città: Milano
Messaggi: 3736
|
ma il funzionamento è intrinseco nella main; lancialo fornendo come argomnto due valori interi come ad esempio 10 8
ti dovrebbe apparire il cursore lampeggiante in decima colonna ed ottava riga è tutto qui quello che fa il codice si tratta solo di adattarlo alle proprie esigenze |
|
|
|
|
|
#12 |
|
Senior Member
Iscritto dal: Apr 2001
Città: Milano
Messaggi: 3736
|
questa è la mia prova il risultato è sotto (X (10, 8))
Project1.exe 10 8 X (10, 8) |
|
|
|
|
|
#13 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
La cin e la cout con Visual C++ non stampa dove ci si sposta con la SetConsoleCursorPosition...
leon84 : posta il codice... |
|
|
|
|
|
#14 | |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Quote:
leon84 : fai come dice misterx... |
|
|
|
|
|
|
#15 | |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
Prova questo
Quote:
Date un occhiata a questo codice : ho utilizzato ciò che misterx mi ha postato anche se ho modificato qualcosa . Per favore compilatelo e ditemi se a voi funziona . #include <windows.h> #include <iostream.h> #include <stdlib.h> void gotoxy (int a , int b); void main () { system ("cls"); char cognome[20] ; char nome [20]; system("cls"); gotoxy (0,0); cout << "COGNOME' : " ; gotoxy (0,1); cout << "NOME : \n"; gotoxy(20,0); cin >> cognome ; gotoxy (20,1); cin >> nome ; }; void gotoxy (int a , int b) { COORD coord; coord.X = a; coord.Y = b; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hConsole, coord); } Comunque non ottengo i risultati sperati . Come ho già detto io voglio visualizzare cognome e nome e dopo pormi con la funzione gotoxy che mi sono creato al fianco di ognuno per leggere i dati . Con il Borland C++ e con Dev C++ non ci metto nulla . Perché sto cavolo di visual c++ tanto potente ha questi limiti (tra parentesi ovviamente ) ? |
|
|
|
|
|
|
#16 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Nemmeno in DevC++ c'è la gotoxy !!!
Ho scoperto perchè prima a me non funzionava !!! Era una questione di dichiarazione della cout e della cin...anche se me la spiego lo stesso male questa cosa... Codice:
#include <windows.h>
#include <iostream> //questo lo devi includere senza .h
#include <stdlib.h>
using namespace std; //devi usare il namespace std di iostream
void gotoxy (int a , int b);
void main ()
{
system ("cls");
char cognome[20] ;
char nome [20];
system("cls");
gotoxy (0,0);
cout << "COGNOME' : " ;
gotoxy (0,1);
cout << "NOME : ";
gotoxy(20,0);
cin >> cognome ;
gotoxy (20,1);
cin >> nome ;
}
void gotoxy (int a , int b)
{
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
COORD coord;
coord.X = a;
coord.Y = b;
SetConsoleCursorPosition(hConsole, coord);
}
|
|
|
|
|
|
#17 | |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
Tutto OK
Quote:
Ok Finalmente tutto a posto . Vi ringrazio tantissimo . Però un'altra cosa me la dovete dire : Quale è la differenza tra iostream e iostream.h e cosa è un namespace ? Ma la iostream a differenza della iostream.h mi permette di fare le stesse cose ? |
|
|
|
|
|
|
#18 |
|
Senior Member
Iscritto dal: Jul 2002
Città: Napoli
Messaggi: 1964
|
Altro quesito
Sapete mica come si implementa un pò di grafica sempre con sto benedetto Visual C++ di Microsoft ? Grafica intendo sotto DOS non l'ambiente visuale ( finestre) . Del tipo : tracciare linee , scrivere testo , tracciare cerchi , colore di sfondo , ecc .. Fatemi sapere ?
|
|
|
|
|
|
#19 | |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Re: Altro quesito
Quote:
E dubito che la Borland distribuisca ancora la BGI con Borland C++ Builder... iostream e iostream.h dovrebbero essere identiche in teoria...la differenza dovrebbe stare solo nell'uso dei namespace... Il namespace definisce lo scoop di visibilità degli oggeti definiti al suo interno... Più strutture possono stare all'interno di un namespace... Più include possono definire ed arricchire lo stesso namespace... Se te indichi che vuoi usare un certo namespace... In quel blocco di codice avrai direttamente visibili gli oggetti definiti al suo interno... Senza usare la using per usare cout e cin avrei dovuto "entrare" nel namespace con std::cin e std::cout... Ad esempio potrei definire implementazioni diverse di una classe a seconda del namespace usato... I principali oggetti della Standard Library e della Standard Template Library sono definiti all'interno del namespace std... Il namespace è stato aggiunto in una definizione nemmeno tanto recente dello standard relativo al C++... |
|
|
|
|
|
|
#20 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Se hai bisogno di più chiarezza : http://www.mvps.org/windev/cpp/nspaces.html
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 17:01.



















