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 converttoint(int ai){
	int ansint=0;
        int c=0;
	while(ai>0){
		ansint+=(ai%10)*pow(2,c);
		c++;
		ai/=10;
	}
	return ansint;
}

double converttodecimal(int af){
	double ansdeci=0;
	int c=-1;
	int naf=0;
	if(af%10==0) af=af/10; 
	while(af>0){
		naf=naf*10+(af%10);
		af/=10;
	}
	while(naf>0){
		ansdeci+=(naf%10)*pow(2,c);
		c--;
		naf/=10;
	return ansdeci;
	}
	
}
main_program{
	unsigned int ibinary,fbinary;
	cin>>ibinary>>fbinary;
	cout<<fixed;
	cout.precision(2);
	cout<<converttoint(ibinary)+converttodecimal(fbinary);

}

Grading criterion: calculation of final decimal number in main function by adding outputs from two functions
Rating A: if integer and fractional parts are called in main function and added to give correct decimal number
Rating B: if integer and fractional parts are called in main function but final answer is wrong
Rating C: if addition of integer and fractional part is not done
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 x,y;
cin>> x>>y;
int sum=0,l;
int k=1;
while(x<=1){
l=x%10;
x=x/10;
sum=sum+l*k;
k=k*2;}
int a=1,sum2=0,d=0;
int m;
while(a<=y){
d++;
a=a*10;}
while(y<=1){
m=y%10;
y=y/10;
sum2=sum2+m* pow(0.5,d);
d--;}
cout<< sum+sum2<<endl;}

Grading criterion: calculation of final decimal number in main function by adding outputs from two functions
Rating A: if integer and fractional parts are called in main function and added to give correct decimal number
Rating B: if integer and fractional parts are called in main function but final answer is wrong
Rating C: if addition of integer and fractional part is not done
Rating D: 0
Assigned grade: C
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:
int_main {
float x;
cout<<"enter a number"<<endl;
cin>>"x">>;
if(x=(2^-2)+(2^-1)+(2^0))
{
cout<<"x is decimal number"<<endl; }
else{
cout<<"x is not in decimal form"<<endl;
}
}

Grading criterion: calculation of final decimal number in main function by adding outputs from two functions
Rating A: if integer and fractional parts are called in main function and added to give correct decimal number
Rating B: if integer and fractional parts are called in main function but final answer is wrong
Rating C: if addition of integer and fractional part is not done
Rating D: 0
Assigned grade: C
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_binary( int a ){
	int b,c,d;
	c=0;
	d=0;
	repeat(3){
		b=a%10;
		a=a/10;
		c= c + pow(2,d)*b;
		d=d+1;
	}
	return c;
}
double decimal_binary(int p){
	double q,s,r,t;
	r=0;
	s=-1;
	t=1;
	repeat(3){
		p=p/t;
		if(p>0){
			q=1;
			t=t*10;
			r = r + pow(2,s)*q;
			s=s-1;
			continue;}
		else
		{q=0;
		r = r + pow(2,s)*q;
		s=s-1;}

	}
	return r;
}

main_program{
	int x,f,y;
	double z,w;
	cin>>x>>y;
	f = integer_binary(x);
	z = decimal_binary(y);
	w = f+z;
	cout<<fixed;
	cout.precision(2);
	cout<<w<<endl;
}

Grading criterion: calculation of final decimal number in main function by adding outputs from two functions
Rating A: if integer and fractional parts are called in main function and added to give correct decimal number
Rating B: if integer and fractional parts are called in main function but final answer is wrong
Rating C: if addition of integer and fractional part is not done
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_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: calculation of final decimal number in main function by adding outputs from two functions
Rating A: if integer and fractional parts are called in main function and added to give correct decimal number
Rating B: if integer and fractional parts are called in main function but final answer is wrong
Rating C: if addition of integer and fractional part is not done
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 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 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 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 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 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{









}

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

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>
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 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 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 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 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 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 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 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; int b;
	float value;
	cin >> a >> 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>

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 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