CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
int func1(int a){
	int i=10;
	int b=0;
	int c=0;
	int d=0;
      while(a%i!=a){
              c=(a%i
	      b=(a%i)*pow(2,c);
	      c++;
	      i=i*10;

      }

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
int integer(int &a){
	cin>>a;
	int i=0,b,result=0;
	while(a/(10^i)>0){
		b = 
}
main_program{
	int a;
	cout<<integer(a);
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include <simplecpp>
int before(int a){
	return a;
	}
double after(int a){
	double b=a;
	while(b>=1){
		b=b/10;
		}
	return b;
	}
main_program{
	int a,b;
	cin >> a >> b ;
	double c= after(b);
	cout << c;
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
 
	int bradix (int n1) {
 		int value = 0; int d = n1;
		int j = 0;
		for (int i = 1; i<=d; i = i*10) {
			int digit = n1%10;
			value = value + digit*(pow(2, j));
			n1 = n1/10; j++;
			
			}
		return value;
		}

	double aradix (int n2) {
		double value = 0; int d = n2;
		int p = 1, l = 0;
		for (int k = 1; k <= n2; k=k*10) {
			l++;
			
		}
		
		for (int m = 1; m <= d; m = m*10) {
			int digit = n2/(pow(10,l-1));
			value = value + digit*(pow(2, -p));
			int power = pow(10, (l-1));
			n2 = n2%power; p++; l--;
		}
		return value;
	}
	main_program{
	int x1; cin >> x1;
	int x2; cin >> x2;
		cout << fixed; cout.precision(2);
		cout << bradix(x1) + aradix(x2);
	}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
int binaryint(int inp)
{
	int count = 0 , ans = 0;

	while(inp > 0)
	{
		int dig = inp % 10;
		ans = ans + dig * (pow(2 , count));
		count++;
		inp = inp / 10;
	}
	return ans;
}

double binaryfrac(int inp1)
{
	int n = inp1;
	int  ext = 0 , dig1 = 0;
	double ans1 = 0 ;

	while(inp1>0)
	{
		ext++;
		inp1 = inp1 / 10;
	}
	

	while(n>0)
	{
		
		dig1 = n % 10;
		ans1 = (dig1 * pow(2,-1 * ext)) + ans1 ;

		ext--;
		n = n / 10;
	}

	return ans1;

}
main_program
{
	int intdeci , intbin , fracdeci ; 

	cin>>intdeci>>fracdeci;

	intbin = binaryint(intdeci);
	double	fracbin = binaryfrac(fracdeci);

	double a = intbin+fracbin;
	
	cout<<fixed;
	cout.precision(2);
	cout<<a;
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include <simplecpp>

int binary_to_deci_int(int num_before_radix){
	int result=0;
	int bin_digit;
	int pow_two=0;
	while(num_before_radix>0){
		bin_digit=num_before_radix%10;
		result+=pow(2,pow_two)*bin_digit;
		num_before_radix=num_before_radix/10;
		pow_two++;
	}
	return result;
}

double  binary_to_deci_fract(int num_after_radix){
	double result=0;
	int temp=num_after_radix;
	int total_digit=0;
	int bin_digit;
	while(temp>0){
		total_digit++;
		temp=temp/10;
	}
	while(num_after_radix>0){
		bin_digit=num_after_radix%10;
		result+=pow(2,total_digit*(-1))*bin_digit;
		total_digit--;
		num_after_radix=num_after_radix/10;
	}
	return result;
}
main_program{
	int num_before_radix,num_after_radix;
	cin>>num_before_radix>>num_after_radix;
	cout<<fixed;
	cout.precision(2);
	double result;
	result=binary_to_deci_int(num_before_radix)+binary_to_deci_fract(num_after_radix);
	cout<<result<<endl;
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program{
	int a,b;
	cin>>a>>b;
	for(int i=0;i

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program {
	int a,b; cin>>a>>b;
	int d=1,t=10;
	while(a>10){
		d++;
		t=t*10;}
	double n=0.0;
	repeat(d) {
		n= n+ (pow(2,d-1));
		d=d-1;}
	int k=1, p=10;
	while(b>p) {
		k++; p=p*10;}
	double m=0.0;
	repeat(k) {
		m=m+ (pow(2,-(k-1)));
		k=k-1;}
	cout<< n+m-1<<endl;

}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program{
	double i;
	cin>>i;
	double num=i;
	while(num>0){
		int term;
		term=num%10;

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include <simplecpp>
int intValue(int a){
	int x,y=0,i=1;
	while(a!=0){
		x=a%10;
		y+= x*i;
		a/=10;
		i*=2;}
	return y;
}
double dec(int b){
	double y;
	double d,e,k,l,m;
	if(b<10){ y=b/2;}
	else if(b<100) {
		d=b%10;
		e=b/10;
		y= d/4+e/2;
	}
	else if(b<1000){
		k=b%10;
		b/=10;
		l=b%10;
		b/=10;
		m=b;
		y=k/8+l/4+m/2;
	}
	return y;
}
int main(){
	int q,w;
	cin >>q >>w;
	cout << intValue(q)+dec(w) <<endl;
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program{
	int bradix,aradix;
	cin>>bradix>>aradix;
	int m=1,s=0;
	while(bradix>0){
		int digit=bradix%10;
		s=s+digit*m;
		m=m*2;
		bradix/=10;
	}
	double p=0;
	while(aradix>0){
		double digit=aradix%10;
		double term=digit/2;
		p=p/2+term;
		aradix/=10;
	}
	double num=s+p;
	cout<<fixed;
	cout.precision(2);
	cout<<num;
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>

main_program{
	int a,b;
	cin>>a>>b;
	int i = 0;
	int sum = 0;
	while(a*pow(2,i) >= pow(10,i)){
		int p;
		p = a%2;
		a = a/2;
		sum = sum + p*pow(2,i);
		i = i + 1;
		}
        float sum2 = 0;
        int p=0;
	while(b > pow(10,i)){
	p = p+1;
	i = i+1;
	}
	int q;

	while(-1 < p){
	q = b/pow(10,p);
	sum2 = sum2 + q*pow(2,(-(i + i)));
	i = i+1;
	p = p-1;}
       	


	float sum3;
	sum3 = sum + sum2;
	cout<<" "<<sum3;
	}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
int integer(int a){
	for (int i = 0; a>0; i++){
		int remainder=0;
		remainder = remainder + (a%10)*pow(2,i);
		a = a/10;
	}
	return remainder;
}
int decimal(int b){

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
int convert_integral(int a)
{
	int twopoweri=1;
	int decimal=0;
	while(a!=0)
	{
		decimal=decimal+(a%10)*twopoweri;
		a=a/10;
		twopoweri=twopoweri*2;
	}
	return decimal;
}

float convert_fractional(int b)
{
	float twopoweri=0.5, decimal=0;
	int b_reverse=0;
	while(b!=0)
	{
		b_reverse=b_reverse*10+b%10;
		b=b/10;
	}
	while(b_reverse!=0)
	{
		decimal=decimal+twopoweri*(b_reverse%10);
		twopoweri=twopoweri/2;
		b_reverse=b_reverse/10;
	}
	return decimal;
}

main_program
{
	int integral, fractional;
	cin>>integral>>fractional;
	int decimal_integral=convert_integral(integral);
	float decimal_fractional=convert_fractional(fractional);
	float decimal= decimal_integral+decimal_fractional;
	cout.precision(2);
	cout<<fixed<<decimal;
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>

main_program {
	int k,brad,arad;
	int sum = 0;
	int i=0;

	cin >> brad >> arad ;

	while(brad!=0) {
	 k = brad%10;
	 sum = sum + k*pow(2,i);
	 brad = brad/10;
	 i++;
	}
	
	int n;
	n=-1;
	float k1,deci;
	deci=0;
	while(arad!=0) {
		k1 = arad%10;
		deci = deci + k1*pow(2,n);
		arad=arad/10;
		n--;
	
	}
	float tot;
	tot=sum+deci;

	cout<<fixed;
	cout.precision(2);
	cout<< tot  <<endl; 
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>

int reverse(int n){
	int reverse=0;
	
	while(n>0){
		int r=n%10;
		reverse=reverse*10+r;
		n/=10;
	}
	return reverse;
}

int integer(int n){
	int sum=0;
	int i=1;
	while(n>0){
	int r=n%10;
	sum+=r*i;
	i*=2;
	n/=10;
	}
	return sum;
	}

double decimal(int n){
	int k=reverse(n);
	double sum=0;

	double i=0.5;
	while(k>0){
		double r=k%10;
		sum+=r*i;
		i*=0.5;
		k/=10;
	}
	return sum;
}




main_program{
	int n,m;
	cin>>n>>m;
	cout<<fixed;
	cout.precision(2);
	cout<<integer(n)+decimal(m)<<endl;
	
}

Grading criterion: is the decimal number correctly calculated?
Rating A: if extracted digits are multiplied with negative powers of two to get correct decimal number
Rating B: if multiplication of digit with powers of two was wrongly done
Rating C: 0
Rating D: 0
Assigned grade: B