Click here to Skip to main content
15,900,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: [newbie] RichEdit questions Pin
Taka Muraoka15-Jan-03 20:29
Taka Muraoka15-Jan-03 20:29 
GeneralWindow not visible after logon Pin
SJBenner15-Jan-03 16:39
sussSJBenner15-Jan-03 16:39 
GeneralRe: Window not visible after logon Pin
Mike Nordell15-Jan-03 22:45
Mike Nordell15-Jan-03 22:45 
GeneralWeird error when reference *.lib file Pin
tongc15-Jan-03 15:05
tongc15-Jan-03 15:05 
Generaldetails? Pin
AlexO16-Jan-03 3:28
AlexO16-Jan-03 3:28 
GeneralAccessing/remoting a network PC Pin
vlusardi15-Jan-03 13:37
vlusardi15-Jan-03 13:37 
GeneralRe: Accessing/remoting a network PC Pin
xxhimanshu15-Jan-03 17:39
xxhimanshu15-Jan-03 17:39 
Generalextreme newbie needs advice Pin
nailbender15-Jan-03 13:22
nailbender15-Jan-03 13:22 
Is there a better way to write this very simple code?

// high score
#include <iostream.h>

void main()
{
int playersScore = 0;
int highScore[10] = {10525,9832,8145,6445,4540,3834,3106,2536,1879,928}; // default scores
int c = 0;


cout <<"High Scores\n";
do
{

cout <<"\n" <<c+1 <<="" "\t"="" highscore[c];
="" c++;
="" }

="" while="" (c="" <="" 10);
="" c="0;

" cout="" <<"\nenter="" players="" score="" :";
="" cin="">> playersScore;

if (playersScore < highScore[9])
cout <<"YOU SUCK!!!\n\n";


while (playersScore > highScore[9])
{
if (playersScore > highScore[0])
{
highScore[9] = highScore[8];
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = highScore[2];
highScore[2] = highScore[1];
highScore[1] = highScore[0];
highScore[0] = playersScore;
break;
}
if (playersScore > highScore[1])
{
highScore[9] = highScore[8];
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = highScore[2];
highScore[2] = highScore[1];
highScore[1] = playersScore;
break;
}
if (playersScore > highScore[2])
{
highScore[9] = highScore[8];
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = highScore[2];
highScore[2] = playersScore;
break;
}
if (playersScore > highScore[3])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = highScore[3];
highScore[3] = playersScore;
break;
}
if (playersScore > highScore[4])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = highScore[4];
highScore[4] = playersScore;
break;
}

if (playersScore > highScore[5])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = highScore[5];
highScore[5] = playersScore;
break;
}

if (playersScore > highScore[6])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = highScore[6];
highScore[6] = playersScore;
break;
}

if (playersScore > highScore[7])
{
highScore[9] = highScore[8];
highScore[8] = highScore[7];
highScore[7] = playersScore;
break;
}
if (playersScore > highScore[8])
{
highScore[9] = highScore[8];
highScore[8] = playersScore;
break;
}

if (playersScore > highScore[9])
{
highScore[9] = playersScore;
break;
}


}

cout <<"\n\nHIGH SCORES";
do
{

cout <<"\n" <
GeneralRe: extreme newbie needs advice Pin
Taka Muraoka15-Jan-03 13:32
Taka Muraoka15-Jan-03 13:32 
GeneralRe: extreme newbie needs advice Pin
JohnMcL15-Jan-03 13:44
JohnMcL15-Jan-03 13:44 
GeneralRe: extreme newbie needs advice Pin
Christian Graus15-Jan-03 15:37
protectorChristian Graus15-Jan-03 15:37 
GeneralDependency Walker Pin
ursus zeta15-Jan-03 13:05
ursus zeta15-Jan-03 13:05 
GeneralRe: Dependency Walker Pin
nde_plume15-Jan-03 14:04
nde_plume15-Jan-03 14:04 
GeneralRe: Dependency Walker Pin
Michael Dunn15-Jan-03 15:39
sitebuilderMichael Dunn15-Jan-03 15:39 
GeneralRe: Dependency Walker Pin
Jason Henderson16-Jan-03 3:02
Jason Henderson16-Jan-03 3:02 
GeneralHuge Thanks Pin
ursus zeta16-Jan-03 6:13
ursus zeta16-Jan-03 6:13 
QuestionShell to Notepad? Pin
Dov Sherman15-Jan-03 12:53
Dov Sherman15-Jan-03 12:53 
AnswerRe: Shell to Notepad? Pin
Joaquín M López Muñoz15-Jan-03 21:18
Joaquín M López Muñoz15-Jan-03 21:18 
GeneralDiagnostic Tools Pin
Anonymous15-Jan-03 12:10
Anonymous15-Jan-03 12:10 
GeneralRe: Diagnostic Tools Pin
Christian Graus15-Jan-03 15:51
protectorChristian Graus15-Jan-03 15:51 
GeneralHide mouse pointer Pin
paulb15-Jan-03 11:56
paulb15-Jan-03 11:56 
GeneralRe: Hide mouse pointer Pin
Christian Graus15-Jan-03 12:11
protectorChristian Graus15-Jan-03 12:11 
GeneralAFX_MODULE_THREAD_STATE Pin
Karl Lean15-Jan-03 11:50
Karl Lean15-Jan-03 11:50 
GeneralCSocket Second Receive not responding Pin
Glenn E. Lanier II15-Jan-03 11:10
Glenn E. Lanier II15-Jan-03 11:10 
GeneralRe: CSocket Second Receive not responding Pin
User 665815-Jan-03 11:29
User 665815-Jan-03 11:29 

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.