for循环问题
我想当a=6时跳出循环结束程序。。但是a不等于6是程序也结束了。为什么?# include <stdio.h>
#include<string.H>
void main()
{
for(;;)
{
int grand,a;
printf("Please write the grand :\n");
scanf("%d",&grand);
if(grand<=100&&grand>=90)a=1;
else if(80<=grand&&grand<=89)a=2;
else if(70<=grand&&grand<=79)a=3;
else if(60<=grand&&grand<=69)a=4;
else if(0<=grand&&grand<=59)a=5;
else if(grand<0||grand>100)a=6;
printf("%d\n",a);
switch(a)
{
case 1:printf("A");break;
case 2:printf("B");break;
case 3:printf("C");break;
case 4:printf("D");break;
case 5:printf("E");break;
}
if(a=6)break;
}
getchar();
}