Do while loop [help]

is my condition (the underlined) wrong? cause whether I press 'y' or 'n', the program will not run again.

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
  #include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main()
{
	char a;
	string sub;
	int gra;
	
	
do
{
	cout<<"Enter Number of Subject"<<endl;

	cout<<"\tGrade: "<<endl;
	cin>>gra;
	cout<<"Another Subject?";
	cin>>a;
}while((a=='y')&&(a=!'n'));



system("pause");
return 0;
	
}
Last edited on
while(a=='y'); is fine and sufficient.
i.e. if a==y then its automatically != n
Topic archived. No new replies allowed.