Issue with some code

Hi I am trying to teach myself programming and one thing I am currently working with is I want to basically create a math test, I want to write it So that It asks the user if they want to take a Addition or Subtraction Test and i cant get the input to work correctly (Do while Validation Loop to make sure that its an A or an S) I have never tried this before but i would like some sort of Validation to make sure it is an (a) or an (s).


The Do While Loop I have Repeats no matter what is input right now

*Note I tried to add an output of the word Hello before the input and It repeats the output once for every character entered in the input when it repeats

So it says
Hello
(Input (A))
Hello
(Input (AA))
HelloHello


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <string>
using namespace std;


int main()
{

// Variable I am using for input for the Addition or Subtraction choice
char choice;

// Get Data from users
	cout<< "Would you like to do Addition or Subtraction" <<endl<<"(A) for Addition (S) for Subtraction"<<endl;
	do 
	{
		cin>>choice;
	}
	while (choice != 'a'||choice != 's');









/*    Everything Below is Part of my Code that works correctly its the addition
 half of the test, I am trying to use an Else if off of "choice" to select it */


Last edited on
while (choice != 'a'&& choice != 's');
Last edited on
Thank you I was just getting so frustrated at it I guess I didn't think about that. Thank you :)
Topic archived. No new replies allowed.