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 integer(int m)
     {
        int sum=0;
        int i=0;
        int j=0;
        int temp;
        while(m>0)
        {
           temp = m%10;
           j= pow(2,i);
           sum = sum + (j*temp);
           m=m/10;
           i++;
        }
      return sum;
     }
     double decimal(int n)
     {
        double sum = 0;
        int i=-1;
        double j=0;
        int temp;
        int s=n;
        int g=0;
        int f =n;
        while (f>0)
        {
           g++;
           f= f/10;
        }
        g--;
        int h;
        while(s>0)
        {
          
           temp=n/(pow(10,g));
           j=pow(2,i);
           sum= sum+ (j*temp);
           h= pow(10,g);
           n= n%h;
           s=s/10;
           i--;
           g--;
        }
      return sum;
     }
        
main_program
{
int x, y;
cin>>x>>y;
float t,w;
t= integer(x);
w = decimal(y);
float final = t+w;
cout<<fixed;
cout.precision(2);
cout<<final<<endl;
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 n1,n2,p;
	for(p=3,p<10,p--){

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 int_part(float n){int t;
	             t=n;
		      
	       return (t);}
float dec_part(float n){int t= n;
                        float  r=n-t;
		        return (r);}
		main_program{ }

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 , c ,d ;

	cin>> a >> b >> " " >>c >>d ;


	float  A ,B ,C ,D ;


	if(a = 1); A = 2;
	else (a = 0 ); A = 0; 


	if(b = 1); B = 1 ;
	else (b = 0 ); B = 0 ;
	


	if( c = 1); C = 0.5;
	else  (c = 0 ); c = 0;
	

	if ( d = 1 ); D = 0.25;
	else  ( d = 0 ); D = 0;


	cout << A+B+C+D << endl;
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 x;
	cout<<"enter the binary number";
	cin>>x;
	int i=0,
	while(x<pow(10,i)){
		i++;
	}
	cout<<i;
	double sum=0;
	for(t=2,t<=i+1,t++){
		sum+=(x%pow(10,t-1))*pow(2,t-1);
	}
	int j=0,
	while((x/pow(10,i))>=pow(10,j)){
		j--;
	}
	j-=2;
	cout<<j;
	double sum2=0;
	for(t=-1,t>=j,t--){
		sum2+=((x*pow(10,abs(j)))%pow(10,i+abs(j)))*pow(2,j);
	}
	cout<<sum+sum2;
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 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: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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 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: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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:
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: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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_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: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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_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: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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(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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>
main_program{
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: B