0
ask=1;
while(ask==1)
{
    System.out.println("What is your phrase?");
    phrase=sc.nextLine();
    System.out.println("What is your additive key?");
    key=sc.nextInt();
    String code=addit(phrase, key);
    System.out.println(code);
    System.out.println("Enter 1 to go again");
    ask=sc.nextInt();
}

Skips straight to asking what my additive key is after the first time through the loop anyone know why?

Touchstone
  • 5,575
  • 7
  • 41
  • 48

1 Answers1

1

So, based on what @PakkuDon is saying, this should fix the problem:

ask = 1;
while(ask == 1)
{
    System.out.println("What is your phrase?");
    phrase = sc.nextLine();
    System.out.println("What is your additive key?");
    key = sc.nextInt();
    String code = addit(phrase, key);
    System.out.println(code);
    System.out.println("Enter 1 to go again");
    ask = sc.nextInt();
    String tmp = sc.nextLine();
}
Alvin Bunk
  • 7,621
  • 3
  • 29
  • 45