View Code of Problem 13

#include<bits/stdc++.h>
using namespace std;
int main(){
	int h,a,b,k,c=0;
	while(cin>>h>>a>>b>>k){
		for(i=0;i<k;i++){
			h-=a;
			if(h<1){
			cout<<"Case #"<<c++<<": White win"<<endl;
			break;
			}
			h+=b;
		}
		if(h>=1){
			cout<<"Case #"<<c++<<": Unknow"<<endl;
		}
	}
	return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:6:7: error: 'i' was not declared in this scope
   for(i=0;i<k;i++){
       ^
*/

Double click to view unformatted code.


Back to problem 13