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 convert_int(int a)
{
	int m=1;
	int ans=0;
	while(a>0)
	{
		ans += (m*(a%10));
		a/=10;//removes last digit of a
		m*=2;
	}
	return ans;
}
double convert_dec(double b)
{
	double p=0.5;
        double ans_1=0.0;
	b*=10;
        while(b>0.001)
        {
		int y=b;//contains integer part of a.
                ans_1 += (p*y);
		b= b- y;//removes the integer part.
                b*=10;//gets the next decimal into one's place.
                p=p*0.5;
		//cout<<a<<" "<<m;
        }
        return ans_1;

}
main_program
{
	double n;
	cin>>n;
	int x=n;//integer part of n
	int int_part = convert_int(x);
	double dec= n-x;
	double dec_part= convert_dec(dec);
	double answer = int_part+dec_part;
	cout<<fixed;
	cout.precision(2);
	//cout<<x<<endl;
	//cout<<(n-x)<<endl;
	cout<<answer<<endl;
	//cout<<int_part<<endl;
	//cout<<dec_part<<endl;

}

Grading criterion: is each digit 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{

}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 m){
	int k=0,i=0; 
	while(m!=0){
		k +=(m%10)*pow(2,i);
		m /=10;
		i++;}
	return k;}
double fraction(int n){
	int j=1;
	double l;
	while(n!=0){
		l +=(n%10)*pow(2,j);
		n/=10;
		j++;}
	l/=pow(2,j);
	return l;}

main_program{
	int intpart, fracpart;
	cin>>intpart>>fracpart;
	double finalin = integer(intpart);
	double finalfrac= fraction(fracpart);
	double result = finalin+finalfrac;
	cout<<fixed;
	cout.precision(2);
	cout<<result;
}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 digit(int x) {
	int n=1;
	while ((x/pow(10,n-1)) >10) {
		n++;
	}
	return n;
}
float integer(int x) {
	int n=0;
	float sum=0,z=0;
	while (x>0) {
		int k= x%10;
		if (k==0) z=0;
		else z= pow(2,n);
		sum += z;
		n++;
		x= x/10;
	}
	return sum;
}
double floating(int x,int y) {
	int n=0;
	double sum=0,z=0;
	while (x>0) {
 int k= x%10;
                if (k==0) z=0;
                else z= pow(2,n);
                sum += z;
                n++;
                x= x/10;
	}
	int d= digit(y);
	while (y>0) {
		int k= y%10;
                if (k==0) z=0;
                else z= pow(2,-d);
		 sum += z;
                d--;
                y= y/10;
	}
	return sum;
}
main_program {
	int x,y;
	cin >>x >>y;
	cout <<fixed;
	cout.precision(2);
	if (y==0) {
		cout << integer(x) <<endl;
	}
	else {
		cout << floating(x,y) <<endl;
	}
}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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{









}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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{
}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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{
			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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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; int b;
	float value;
	cin >> a >> b;
}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
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 a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
Rating C: 0
Rating D: 0
Assigned grade: A