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{
	int a,b;
	cin>>a>>b;
	int sum=0,i=0,n;
        while(a!=0){
	        n=a%10;
		a=a/10;
		sum=sum+n*pow(2,i);
		i++;
	}
	int sum2=0,j=-1,z;
	while(b!=0){
		z=b%10;
		z=z/10;
		sum2=sum2+z*pow(2,j);
		j--;
	}
	float ans=sum+sum2/100;
	cout<<ans;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 integerbinary( int num){
		int n=0;
		int sum=0;
		while(num!=0){
			if(num%10==0){
				sum+=0;
			}
			else{
				sum=sum+pow(2,n);
			}
			n+=1;
			num=num/10;
		}
		return sum;
	}
	double fractionbinary( int num2){
		int n2=0;
		int power=1;
		double sum2;
		while((num2/power)>0){
			n2=n2+1;
			power*=10;
		}
		n2=n2*(-1);
				while(num2!=0){
				if(num2%10==0){
				sum2+=0;
				}
				else{
				sum2=sum2+pow(2,n2);
				}
				n2=n2+1;
				num2=num2/10;
				}
				return sum2;
				}
				main_program{
				
	int inp1, inp2;
	double part1, part2, total;
	cin>>inp1>>inp2;
	part1=integerbinary(inp1);
	part2=fractionbinary(inp2);
	total=part1+part2;
	cout<<fixed;
	cout.precision(2);
	cout<<total<<endl;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 ibtid(int n)//function to convert integer part of binary to integer part of decimal
{
	int v,s1=0,i=0;
	repeat(16)
	{
		v = n%10;
		s1 += v*pow(2,i);
		n = n/10;
		i++;
	}
	return s1;
}
double ibtdd(int f)//function to convert decimal part of binary to decimal part of decimal 
{
	int w,i= 0,s=f,k=1;
	double s2=0;
	while(s!=0)
	{
		s =s/10;
		k++;
	}
	k--;
	repeat(k)
	{
		w = f%10;
		s2 += w*pow(2,-k+i);
		f = f/10;
		i++;
	}
	return s2;
}
int main()
{
	int a,b;
	cin>>a>>b;
	double  fsum;
	fsum = ibtid(a) + ibtdd(b);
	cout<<fixed;
	cout.precision(2);
	cout<<fsum;
	return 0;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 digit(int a){
	int i;
	for(i=0; a>=1; i++){
		a/=10;
	}
	return(i);
}
main_program{
	int a,b;
	cin>>a>>b;
	int adigit=digit(a);
	int bdigit=digit(b);
	int j=0, sum1=0;
	float sum2=0;
	repeat(adigit){
		int i=a%10;
		if(i==1) sum1+=pow(2,j);
		j++;
		a/=10;
	}
	j=0;
	repeat(bdigit){
		int i=b%10;
		if(i==1) sum2= sum2 + pow(2,-j);
		j++;
		b/=10;
	}
	cout<<fixed;
	cout.precision(2);
	cout<<sum1+sum2;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 intb(int &a){
	int s1=0;
	int i=0;
	while (a>0){
		s1+=(a%10)*(pow(2,i));
		a=a/10;
		i++;
	}
	return s1;
}
float fracb(int &b){
	float s2=0;
	int rev=0;
	int j=1;
	while (b>0){
		rev=(rev*10)+(b%10);
		b=b/10;
	}
	while (rev>0){
		s2+=(rev%10)*(pow(2,-j));
		rev=rev/10;
		j++;
	}
	return s2;
}
main_program{
	int a,b;
	float res;
	cin>>a>>b;
	res=intb(a)+fracb(b);
	cout<<fixed;
	cout.precision(2);
	cout<<res;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 p1(int bin){
	int sum=0;
	int n=0;
	while(bin>0){
		sum+=pow(2,n) * ((bin)-((bin/10)*10));
		n++;
		bin = bin/10;
	}
	
	return sum;
}

float p2(int bin){
	float sum=0;
	int x=0,temp;
	temp = bin;
	while(bin>0){
		bin=bin/10;
		x++;
	}
	bin = temp;
	while(bin>0){
		sum+=float(pow(2,-x)) * ((bin)-((bin/10)*10));
		x--;
		bin = bin/10;
	}

	return sum;
}



main_program{
	int x,y;
	float s;
	cin >> x >> y;
	s=p1(x)+p2(y);
	cout << s;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 whole_converter(int n)
{
	int digit,pwr = 1, sum = 0;
	for (int d=1; d<=n; d*=10)
	{
		digit = n%(d*10)/d;
		sum += digit*pwr;
		pwr*=2;
	}
	return sum;
}

int no_of_dig(int n)
{
	int i = 1;
	for (int d=1; d<=n; d*=10)
	{
		i += 1;
	}
	return i-1;
}

double decimal_converter(int n)
{
	int digit;
	double sum = 0.0;
	double pwr = 0.5;
	for (int d=pow(10, no_of_dig(n)-1) ; d >=1;d*=0.1)
	{
		digit = n%(d*10)/d;
		sum += digit*pwr;
		pwr *= 0.5;
	}
	return sum;
}		

int main()
{
	int whole;
	float decimal;
	double result;
	cin >> whole >> decimal; 
	result = whole_converter(whole) + decimal_converter(decimal);
	cout << fixed;
	cout.precision(2);
	cout << result;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 binary1(int n)
{
	int sum=0,i=0;
	while(n!=0)
	{
		sum+=(n%10)*pow(2,i);
		n=n/10;
		i++;
	}
	return sum;
}

double binary2(int n)
{
        int i=0;
	double sum=0;
        while(n!=0)
        {
                sum+=(n%10)*pow(2,i);
                n=n/10;
                i++;
        }
        return sum/pow(2,i);
}



main_program
{
	int n1,n2;
	cin>>n1>>n2;
	double value= binary1(n1)+binary2(n2);
	cout<<fixed;
	cout.precision(2);
	cout<<value;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 , d , e , sum ;
	float sumd;

	cin>>a ;
	cout<<" " ;
	cin >> b ;
	d = 0;
	sum = 0;
	sumd =0;
	e = 0;
	for ( int i = 1 ; i<=a ; i*=10){
		int m = a%10;
		sum = sum + m*pow(2,d);
		a=a/10;
		d++;
	}
	cout<<sum;
	int y = 10 ;
	int x = 1 ;
	 while ( b%y!=0){
		y = y - (y%b);
		y = y*10;
		x = x + 1;
	}



	for ( int j  = pow(10,(x-1)) ; j>=1 ; j=j/10){
		sumd = sumd + (b%10)*pow(0.5, x-e);
		b=b/10;
		e++;
	}
	cout<<sum<<sumd;


}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 gif;
	cin >> gif;
	float num = 0;
	float pv = 1;
	while(gif != 0){
		num += (gif % 10) * pv;
		pv *= 2; 
		gif = gif/10;
	}
	int deci;
	cin >> deci;
	int x = deci;
	int i = 0;
	while(x != 0){
		i++;
		x = x/10;
	}
	pv = pow(0.5, i);
	while(deci != 0){
		num += (deci % 10) * pv;
		pv *= 2;
		deci = deci/10;
	}
	cout << fixed;
	cout.precision(2);
	cout << num;

}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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;
	cin>>a>>b;
	float d;

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 binary1(int a) {
	int sum = 0;

	for( int i=0; a>0; a/=10, i++) {
	if(a%10 == 0) {sum += 0;}
	else { sum += pow(2,i);}
	}
	return sum;
}
float binary2(int b) {
	float sum =0;
	int x=b;
	int d;
	for(d=0; x>0 ; d++ , x/=10);
	while(b>0) {
		if(b%10 ==0) {	sum +=0;}
		else{ sum += pow(2,(-d));}
	d--;
	b/=10;


	}
	return sum;
}


main_program {
	int i; cin >> i;
	int j; cin >> j;

	int a=binary1(i);
	float b=binary2(j);

	float sum = a+b;
	cout <<fixed;
	cout.precision(2);

	cout << sum;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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, c1 = 0, c2 = 0, sum1 = 0;
	double sum2, num;
       	int digit, temp1, temp2;
	cin>>n1>>n2;
	temp1 = n1;
	temp2 = n2;
	while(n1 > 0)
	{
		n1 /= 10;
		c1++;
	}
	while(n2 > 0)
	{
		n2 /= 10;
		c2++;
	}
	n1 = temp1;
	n2 = temp2;
	for(int i = 0; i <= c1; i++)
	{
		digit = n1%10;
		sum1 += digit*(pow(2, i));
	        n1 /= 10;
	}
	digit = 0;
	for(int i = c2; i >= 1; i--)
	{
		digit = n2%10;
		sum2 += digit*(pow(2, -i));
		n2 /= 10;
	}
	num = sum1 + sum2;
	cout<<fixed;
	cout.precision(2);
	cout<<num;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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_radix(int n)
{
	int sum=0;
	int i=0;
	while(n>0)
	{
		sum =sum +(n%10)*(int)pow(2,i);
	       i++;
	       n=n/10;
	}
	
	return sum;
}

double after_radix(int n)
{
	int rev=0;
	while(n>0)
	{
		rev=rev*10+n%10;
		n=n/10;
	}
	int i =1;
//	cout<< rev;
	double sum =0;
	while(rev>0)
	{
		sum = sum + (rev%10)*pow(0.5,i);
		i++;
		rev =rev/10;
	}
	return sum;
}
main_program
{
	int n,m;
	cin >> n>>m;
	double decimal =before_radix(n)+after_radix(m);
	cout <<fixed;
	cout.precision(2);
	cout << decimal;
}

Grading criterion: Placeholder for penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 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 penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
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 penalty to be given for any reason
Rating A: Maximum penalty
Rating B: no penalty
Rating C: 0
Rating D: 0
Assigned grade: B