程序要求用戶輸入雙數字1和雙數字2 ,如果有例外,我希望它再次詢問數字1和數字2的輸入 public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
double num1, num2;
int error = 0;
int text;
System.o
我目前正在做CS50課程。我正在嘗試爲第一個問題集製作一個do-while循環,但是我拋出了一個錯誤。幫助會很好,謝謝! #include <cs50.h>
#include <stdio.h>
int main(void)
{
do
{
printf("Enter a positive integer no greater than 23: \n");
我使用的緩衝筆者嘗試輸入文本到記事本,這是我來什麼碼了文本, import java.util.Scanner;
import java.io.*;
public class FileSample {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
Str
我試圖完成的是:當用戶鍵入除1或2以外的任何內容時,將出現提示"I don't understand you",它會要求用戶再次選擇1或2,而不必每次都運行程序。 事情是這樣的: do {
String a = input.nextLine();
num = Integer.parseInt(a);
switch (num) {
case 1:
我正在做一個學校項目,要求我在每個選項後返回到菜單,但我目前遇到使用do-while循環返回菜單的麻煩,因爲我的while(true)由於(真)未定義而導致運行問題。請幫忙! do {
// print out menu
printf("================================== MENU ===============================