Skip to main content

All Questions

0 votes
0 answers
47 views

The while loop in C++ skips the user input line [duplicate]

If you enter a character as the input for the first question the switch statement should throw you into the default clause, and it does. But after that, the following while loop just keeps running ...
Tensora's user avatar
  • 53
0 votes
4 answers
98 views

How do I break out of a while loop from within a switch in an if else statement in C?

I was trying out simple activities about if statements, switches, and loops while studying programming and I ran into this problem. while (1) { if (/*condition*/) { //error } else { ...
Chlaus's user avatar
  • 11
1 vote
2 answers
66 views

How to modify while loop to print extra print statement in next loops? [java]

These current associationMenu uses switch statements to implement methods corresponding to the char input by the user. The while statement loops over untill X is read. I want to make some ...
vishalpd's user avatar
2 votes
1 answer
54 views

Switch and while combination using scanf, how to avoid multiple input

In this switch and while combination, when I press 'a' or 'b' it's fine but I don't want the program to print 1 and 2 when user inputs 'ab'. How can I print an error message when user enters an input ...
Player1 ready's user avatar
-1 votes
1 answer
77 views

Java do-while loop continues even though the condition is false

import java.util.Scanner; public class DealCardsGNN{ public static void main(String[] args){ int numCards = 52; int CardDealt = 0; String CardName = ""; String SuitName = ""; ...
user21505321's user avatar
1 vote
4 answers
86 views

c: break out of switch statement and for loop at once

I have a switch statement, inside for loop, which itself is inside while loop: while ((size = getline(&line, &len, f)) != -1) { for (i = 0; i < size; i++) { switch (line[i]) { ...
Martin Vegter's user avatar
-1 votes
1 answer
70 views

C language doesn't scan variable after reading string or char when int required [closed]

C language doesn't scan variable after reading that variable as string(or char) instead of integer But the most weird is that it is entering in infinite loop int main( ){ int answer; printf(&...
Mihai's user avatar
  • 11
0 votes
1 answer
71 views

How to output invalid input on character limit and a space switch case?

This is the assignment I got, which is based on C++ program to Convert Letters into a Phone Number. However, my lecturer ask for added details including: Insert alphabet as an input The entire ...
beepboop's user avatar
0 votes
2 answers
65 views

JavaScript adding additional actions after receiving the result

I'm making a calculator in JS that displays commands and the result in a prompt. I want to add an action that, after receiving the result of the operation, makes it possible to multiply, divide, etc. ...
magD's user avatar
  • 1
-3 votes
1 answer
59 views

How can i let the user choose if they are a teacher or admin? [closed]

im very new to OOP, and im trying to create a menu for users to click on choose if they are a teacher or an admin Hi there, I'm having a bit of trouble creating a menu for employees. It seems like a ...
Goldii's user avatar
  • 3
-1 votes
1 answer
54 views

Creating a string to integer translator using switch function in java

The thing I am trying to do is converting a word to numbers according to phone standart. The word will be inputted. An example would be the word "Software" becoming "76389273" My ...
kelkrekeksa's user avatar
-2 votes
1 answer
34 views

Need program to output string every fifth time while loop has ran withing a switch case

Hello fellow programmers. I have the following code: public void command() { boolean runSystem = true; while (runSystem) { Scanner sc = new Scanner(System.in); //int ...
Andreas Larsen's user avatar
1 vote
3 answers
84 views

Can I loop through a Switch using C#?

I'm attempting to loop through a switch in C# for a simple console application that returns data based on user input. I am new to coding. I know that the Switch works as I tested it before trying to ...
Nick's user avatar
  • 13
0 votes
0 answers
16 views

How to Correctly Navigate Switch Loop [duplicate]

I am completing a final project for a Java course I am taking. The goal of this project is to create an Asset Management tool that someone could use to enter employees and their employee ID's, ...
MiakaSHW's user avatar

15 30 50 per page
1
2 3 4 5
18