![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Expert Programmer
|
Help!!
How can i clear the screen after i choose to start a new game?
import cs1.Keyboard;
import java.util.*;
public class HiLo
{
public static void main (String[] args)
{
int play = 1;
while(play > 0)
{
Random generator = new Random();
int answer = generator.nextInt(100)+1;
//System.out.println(answer);
//int play = 1;
System.out.println("The computer is thinking of a number \nbetween 1 and 100. What is it?");
int escape = 0;
while(escape < 1)
{
int guess = Keyboard.readInt();
if(guess == answer)
{
System.out.println("That's it");
escape = 1;
}
else if(guess > answer)
{
System.out.println("Too High");
}
else if(guess < answer)
{
System.out.println("Too Low");
}
}
System.out.println("Would you like to play again (y/n)");
char again = Keyboard.readChar();
if(again == 'y')
{
play = 1;
}
else if(again == 'n')
{
play--;
}
}
}
} |
|
|
|
|
#2 |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
What Operating System are you running the program on?
If windows then use Runtime.getRuntime().exec("cls");for(i=0 ;i<30;i++) System.out.println(); |
|
|
|
|
#3 |
|
Expert Programmer
|
would i put that at the end of the code?
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Please choose a germane subject line. Almost everyone wants HELP!!!. There's a nice "How to Post..." thread in the C forum.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
#5 |
|
Programming Guru
![]() |
What is wrong with you people, READ THE FORUM RULES BEFORE POSTING...!
__________________
|
|
|
|
|
#6 |
|
Expert Programmer
|
Well I am sorry but when I need help for something in school I need to make it noticable.
|
|
|
|
|
#7 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
It's simply polite to check out a forum's standards instead of presuming it's an extension of your school or your mama or whatever.
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#8 | |
|
Programming Guru
![]() |
Quote:
__________________
|
|
|
|
|
|
#9 |
|
Expert Programmer
|
I realize that i am not an acception. But this is the best place where i know i can get help when i do not understand something. We are not all perfect like you think you are tempest so fuck off.
|
|
|
|
|
#10 |
|
Programming Guru
![]() |
Yea, i'm the one that thinks i'm perfect? Have i asked for help on these forums before, of course i have... And did i read the forum rules before posting, hell yes i did...
I'm not an arrogant prick who would whine with a rude topic like "Help!!" if i wanted to know how to get something done in an assignment for school that i couldn't do myself. Quite simply, the best way to get help from people is to be courteous to them and respect their institutions.
__________________
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|