private void btnhasil_click(object sender, eventargs e) { int rataipa = convert.toint32(nipa.text); int uipa, uipa1, uipa2, uipa3, uipa4; if ((rataipa >= 61) && (rataipa <= 69)) { uipa1 = (70 - rataipa) / 10; uipa2 = (rataipa - 60) / 12; } else if ((rataipa == 60) && (rataipa >= 70) && (rataipa <= 72)) { uipa2 = (rataipa - 60) / 12; } else if ((rataipa >= 76) && (rataipa <= 84)) { uipa3 = (85 - rataipa) / 13; uipa4 = (rataipa - 75) / 10; } else if ((rataipa >= 72) && (rataipa <= 75) || (rataipa == 85)) { uipa3 = (85 - rataipa) / 13; } else uipa = 1; }
i try build errors shows in variable uipa , shows variable 'uipa' assigned value never used used after , don't know how fix. can ?
you assign uipa
@ end of code never it.
else uipa = 1;
to remove warning, need uipa
or remove above statement entirely. far compiler concerned, uipa
serves no purpose.
if decide use uipa
later in if
statement, sure initialise uipa
default value else run different warning unitialised variables.
int uipa = 0, ....; // initialise uipa here default value . . . else uipa = 1; if (uipa ==1) // solve variable assigned never used problem { // }
Comments
Post a Comment