Click here to Skip to main content
15,914,924 members
Home / Discussions / C#
   

C#

 
QuestionHow to Connect Ordacle DB via C#? Pin
Sankalp Verma26-Apr-08 18:21
Sankalp Verma26-Apr-08 18:21 
AnswerRe: How to Connect Ordacle DB via C#? Pin
Krazy Programmer26-Apr-08 19:07
Krazy Programmer26-Apr-08 19:07 
GeneralSetting focus to a Button Pin
danielk_26-Apr-08 17:52
danielk_26-Apr-08 17:52 
GeneralRe: Setting focus to a Button Pin
Thomas Stockwell26-Apr-08 18:10
professionalThomas Stockwell26-Apr-08 18:10 
GeneralRe: Setting focus to a Button Pin
Anthony Mushrow26-Apr-08 18:20
professionalAnthony Mushrow26-Apr-08 18:20 
GeneralRe: Setting focus to a Button Pin
Urs Enzler26-Apr-08 22:48
Urs Enzler26-Apr-08 22:48 
GeneralRandomly Shuffle an Array Pin
Ian Uy26-Apr-08 17:44
Ian Uy26-Apr-08 17:44 
GeneralRe: Randomly Shuffle an Array Pin
Thomas Stockwell26-Apr-08 17:55
professionalThomas Stockwell26-Apr-08 17:55 
apstring ShuffleAns(apstring ans1,apstring ans2,apstring ans3,apstring ans4)
{
	apstring set[4]={"","","",""};
	set[0]=ans1;
	set[1]=ans2;
	set[2]=ans3;
	set[3]=ans4;
	apstring rval[4]={"","","",""};
	bool  used[4];
	for(int k=0;k<4;k++)
		used[k]=false;
	Random* rnd=new Random();
	int icount=0,inum=0;
	while(icount<4)
	{
		inum=rnd->Next(0,4);
		if(used[inum]==false)
		{
			rval[icount]=set[inum];
			used[inum]=true;
			icount++;
		}
	}
	apstring rvalr=rval[0];
	 rvalr+='~';
	 rvalr+=rval[1];
	 rvalr+='~';
	 rvalr+=rval[2];
	 rvalr+='~';
	 rvalr+=rval[3];
	return rvalr;
}


This is some code that I reuse/translate for all of my projects. I took this particular piece of code from my who wants to be a millionaire program so this randomizes the answers. (This is in C++ by the way, but if you have problems understanding it just post back)

Regards,
Thomas Stockwell

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

Visit my homepage Oracle Studios[^]

GeneralRe: Randomly Shuffle an Array Pin
Ian Uy26-Apr-08 17:56
Ian Uy26-Apr-08 17:56 
GeneralRe: Randomly Shuffle an Array Pin
PIEBALDconsult27-Apr-08 4:31
mvePIEBALDconsult27-Apr-08 4:31 
GeneralRe: Randomly Shuffle an Array Pin
ssclaire27-Apr-08 6:32
ssclaire27-Apr-08 6:32 
QuestionClean Solution Pin
Reza Shojaee26-Apr-08 17:09
Reza Shojaee26-Apr-08 17:09 
GeneralRe: Clean Solution Pin
Christian Graus26-Apr-08 17:15
protectorChristian Graus26-Apr-08 17:15 
AnswerRe: Clean Solution Pin
Reza Shojaee26-Apr-08 17:24
Reza Shojaee26-Apr-08 17:24 
GeneralRe: Clean Solution Pin
Urs Enzler26-Apr-08 22:51
Urs Enzler26-Apr-08 22:51 
Generalquestion Pin
Nabil0026-Apr-08 14:55
Nabil0026-Apr-08 14:55 
GeneralRe: question Pin
Anthony Mushrow26-Apr-08 15:09
professionalAnthony Mushrow26-Apr-08 15:09 
GeneralRe: question Pin
Christian Graus26-Apr-08 16:44
protectorChristian Graus26-Apr-08 16:44 
AnswerRe: question Pin
Krazy Programmer26-Apr-08 19:11
Krazy Programmer26-Apr-08 19:11 
Generalhow to use google Pin
leckey27-Apr-08 14:55
leckey27-Apr-08 14:55 
QuestionButton in MDI floating over my child forms Pin
anjase26-Apr-08 12:02
anjase26-Apr-08 12:02 
GeneralRe: Button in MDI floating over my child forms Pin
Krazy Programmer26-Apr-08 19:13
Krazy Programmer26-Apr-08 19:13 
QuestionDllImport quick quetion please? [modified] Pin
mktrend26-Apr-08 11:18
mktrend26-Apr-08 11:18 
GeneralRe: DllImport quick quetion please? Pin
Christian Graus26-Apr-08 11:22
protectorChristian Graus26-Apr-08 11:22 
GeneralRe: DllImport quick quetion please? Pin
mktrend26-Apr-08 11:28
mktrend26-Apr-08 11:28 

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.