View Code of Problem 96

#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main(void){
	int a;
	while(cin>>a&&a){
		long long sum=0;
		string s;
		cin>>s;
		if(s[0]=='B'){
			sum=0;
		}else if(s[0]=='K'){
			sum=a*24;
		}else if(s[0]=='M'){
			sum=a*(pow(1024,2)-pow(1000,2)); 
		}else if(s[0]=='G'){
			sum=a*(pow(1024,3)-pow(1000,3));
		}else if(s[0]=='T'){
			sum=a*(pow(1024,4)-pow(1000,4));
		}
		cout<<sum<<endl;
	}
}

Double click to view unformatted code.


Back to problem 96