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>
main_program{
}

Grading criterion: is each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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>
float integerpart(int a){
	int n=0, m=0, c;
	for(int i=0;a!=0; i++)(a!=0){
		c=a%10;
		c=c*pow(2,n);
		m=m+c;
		a=a/10;
		n++;
	}
	return m;
}
float fractional(int b){
	int k=0, n=-1, m=0;
	for(int i=0; b!=0; i++){
		int c=b%10;
		k=k+c;
		k*=10;
		n=n/10;
	}
	k=k/10;
	n=k;

	for(int i=0;b!=0;i++){
		int c=b%10;
		c=c*pow(2,n);
		m=m+c;
		b=b/10;
		n--;
	}
return m*pow(10,n);
}
main_program{
	int a, b;
	cin>>a>>b;
	double ans;
	ans= integerpart(a)+fractional(b);
	cout<<fixed;
	cout.precision(2);
	cout<<ans;
}

Grading criterion: is each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 r=0;
			float n;
			int i;

			cin>>n;
		for(i<=n,i++);
		double z;
		z=pow(2,r);
		r++;


		int y= z*i;
		float sum;
		sum+=y;
	}

Grading criterion: is each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 n,ans=0;
	cin>>n;
	int m=n;
	int t=0;
	for(int i=m;i>0;i/=10)
	{
		ans=ans+(i%10)*pow(2,t);
		t++;

	}
	cout<<ans;

}

Grading criterion: is each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 bin_int(int a){
	int sum = 0;
	if (a%10 == 0){
		while (a > 0){
			sum *= 2;
			sum += a%10;
			a = a/10;
		}
		return sum*2;
	}
	else{		
		while (a > 0){
			sum += a%10;
			sum *= 2;
			a = a/10;
		}
		return sum/2;
	}
}

float bin_dec(int b){
	float sum = 0;
	while (b > 0){
		sum += b%10;
		sum /= 2;
		b = b/10;
	}
	return sum;
}

main_program{
	int a, b;
	float c;
	cin >> a >> b;
	c = bin_int(a) + bin_dec(b);
	cout << fixed;
	cout.precision(2);
	cout << c;
	
}

Grading criterion: is each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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; int b;
	float value;
	cin >> a >> b;
}

Grading criterion: is each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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>

double intBinary(int a1){
    int sum1=0,i=0;
    while(a1!=0){
    int remain=a1%10;
    a1=a1/10;
    sum1=sum1+remain*pow(2,i);
    i++;

    }   
    return sum1;
}

double fracBinary(int a2){
     int count,b=a2;
     while(b!=0){
	     b=b/10;
	     count++;
     }
	
     float sum2=0,j=-count;
     while(a2!=0){
	     int remain2=a2%10;
	     a2=a2/10;
	     sum2=sum2+remain2*pow(2,j);
	     j++;
     }


return sum2;
}

main_program{
   int a1,a2;
   float sum=0;
   cin>>a1>>a2;

   sum=sum+intBinary(a1)+fracBinary(a2);
   cout<<sum;
   cout<<fixed;
   cout.precision(2);



}

Grading criterion: is each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
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 each digit of fractional part of binary representation is correctly extracted
Rating A: if each digit is correctly extracted using modulo 10
Rating B: if each digit is not correctly extracted
Rating C: 0
Rating D: 0
Assigned grade: B