Click here to Skip to main content
15,886,801 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: define arrow keys in c Pin
David Crow17-May-10 10:28
David Crow17-May-10 10:28 
AnswerRe: kbhit() Pin
Software_Developer17-May-10 11:03
Software_Developer17-May-10 11:03 
QuestionChange the colour in c Pin
hasani200717-May-10 10:18
hasani200717-May-10 10:18 
AnswerRe: Change the colour in c Pin
Richard MacCutchan17-May-10 10:25
mveRichard MacCutchan17-May-10 10:25 
AnswerRe: Change the colour in c Pin
David Crow17-May-10 10:25
David Crow17-May-10 10:25 
AnswerRe: Change the colour in c Pin
CPallini17-May-10 10:29
mveCPallini17-May-10 10:29 
Questionhow to get the walls from input? Pin
hasani200717-May-10 10:14
hasani200717-May-10 10:14 
AnswerRe: With cin? Pin
Software_Developer17-May-10 11:28
Software_Developer17-May-10 11:28 
For example, this code generates a random maze. Its a console application

#include <iostream.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>


int main()
{
	system("color 1F");
	int rows,columns,r,k;
	int center,c;
	int random_it;
	char someCharacter;
	char lgt1='\xB3';
	char lgt3='\xBF';
	char lgt10='\xD9'; 
	srand(time(0));	

    //system("color 1F")
	cout<<"Maze generator ver 0.000000000001 beta \n\n";
	cout<<"Input columns (x)  > ";
	cin>>columns;

	cout<<"Input rows    (y)  > ";
	cin>>rows;

	center=38-(columns/2);
	
	cout<<'\n';
	for (r=0;r<rows;r++)
	{
		for (c=0;c<center;c++) cout<<" ";//cout<<"|";
		for(k=0;k<columns;k++)
		{
			random_it=rand() % 20;
			if (random_it==0) someCharacter=random_it+lgt1;
			if (random_it==1) someCharacter=random_it+lgt1;
			if (random_it==2) someCharacter=random_it+lgt3-2;
			if (random_it==3) someCharacter=random_it+lgt3-2;
			if (random_it==4) someCharacter=random_it+lgt3-2;
			if (random_it==5) someCharacter=random_it+lgt3-2;
			if (random_it==6) someCharacter=random_it+lgt3-2;
			if (random_it==7) someCharacter=random_it+lgt3-2;
			if (random_it==8) someCharacter=random_it+lgt3-2;
			if (random_it==9) someCharacter=random_it+lgt10-9;
			if (random_it==10) someCharacter=random_it+lgt10-9;
			if (random_it>10) someCharacter='\x20';			
		    cout<<(char)someCharacter;

		}
		//cout<<"|\n";
		  cout<<"\n";
	}




	cout<<"\n";
	return 0;
}


...
QuestionChanging edit box font size Pin
pjdriverdude17-May-10 7:35
pjdriverdude17-May-10 7:35 
AnswerRe: Changing edit box font size Pin
David Crow17-May-10 8:13
David Crow17-May-10 8:13 
GeneralRe: Changing edit box font size Pin
pjdriverdude17-May-10 9:39
pjdriverdude17-May-10 9:39 
Questionhow to know the control? Pin
chikach17-May-10 7:12
chikach17-May-10 7:12 
AnswerRe: how to know the control? Pin
David Crow17-May-10 7:15
David Crow17-May-10 7:15 
GeneralRe: how to know the control? Pin
chikach18-May-10 4:54
chikach18-May-10 4:54 
QuestionPNG image in Dialog Pin
tamila_tamila17-May-10 7:07
tamila_tamila17-May-10 7:07 
AnswerRe: PNG image in Dialog Pin
jeron117-May-10 7:14
jeron117-May-10 7:14 
GeneralRe: PNG image in Dialog Pin
tamila_tamila18-May-10 1:00
tamila_tamila18-May-10 1:00 
QuestionVisual studio debugger yellow arrow cursor/owner draw control Pin
ForNow17-May-10 6:56
ForNow17-May-10 6:56 
AnswerRe: Visual studio debugger yellow arrow cursor/owner draw control Pin
Chris Losinger17-May-10 9:31
professionalChris Losinger17-May-10 9:31 
GeneralRe: Visual studio debugger yellow arrow cursor/owner draw control Pin
ForNow17-May-10 13:00
ForNow17-May-10 13:00 
Questionserial port I/O and console focus strange behavior Pin
pkcinna17-May-10 4:52
pkcinna17-May-10 4:52 
AnswerRe: serial port I/O and console focus strange behavior Pin
Aescleal17-May-10 8:53
Aescleal17-May-10 8:53 
GeneralRe: serial port I/O and console focus strange behavior Pin
pkcinna17-May-10 9:45
pkcinna17-May-10 9:45 
GeneralRe: serial port I/O and console focus strange behavior Pin
pkcinna17-May-10 11:15
pkcinna17-May-10 11:15 
QuestionHow to receive a notification when the app window is activated. Pin
sashoalm17-May-10 4:42
sashoalm17-May-10 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.