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 binary_to_deci_int(int num_before_radix){
	int result=0;
	int bin_digit;
	int pow_two=0;
	while(num_before_radix>0){
		bin_digit=num_before_radix%10;
		result+=pow(2,pow_two)*bin_digit;
		num_before_radix=num_before_radix/10;
		pow_two++;
	}
	return result;
}

double  binary_to_deci_fract(int num_after_radix){
	double result=0;
	int temp=num_after_radix;
	int total_digit=0;
	int bin_digit;
	while(temp>0){
		total_digit++;
		temp=temp/10;
	}
	while(num_after_radix>0){
		bin_digit=num_after_radix%10;
		result+=pow(2,total_digit*(-1))*bin_digit;
		total_digit--;
		num_after_radix=num_after_radix/10;
	}
	return result;
}
main_program{
	int num_before_radix,num_after_radix;
	cin>>num_before_radix>>num_after_radix;
	cout<<fixed;
	cout.precision(2);
	double result;
	result=binary_to_deci_int(num_before_radix)+binary_to_deci_fract(num_after_radix);
	cout<<result<<endl;
}

Grading criterion: is 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,b;
	cin>>a>>b;
	for(int i=0;i

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 {
	int a,b; cin>>a>>b;
	int d=1,t=10;
	while(a>10){
		d++;
		t=t*10;}
	double n=0.0;
	repeat(d) {
		n= n+ (pow(2,d-1));
		d=d-1;}
	int k=1, p=10;
	while(b>p) {
		k++; p=p*10;}
	double m=0.0;
	repeat(k) {
		m=m+ (pow(2,-(k-1)));
		k=k-1;}
	cout<< n+m-1<<endl;

}

Grading criterion: is 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 i;
	cin>>i;
	double num=i;
	while(num>0){
		int term;
		term=num%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 intValue(int a){
	int x,y=0,i=1;
	while(a!=0){
		x=a%10;
		y+= x*i;
		a/=10;
		i*=2;}
	return y;
}
double dec(int b){
	double y;
	double d,e,k,l,m;
	if(b<10){ y=b/2;}
	else if(b<100) {
		d=b%10;
		e=b/10;
		y= d/4+e/2;
	}
	else if(b<1000){
		k=b%10;
		b/=10;
		l=b%10;
		b/=10;
		m=b;
		y=k/8+l/4+m/2;
	}
	return y;
}
int main(){
	int q,w;
	cin >>q >>w;
	cout << intValue(q)+dec(w) <<endl;
}

Grading criterion: is 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 bradix,aradix;
	cin>>bradix>>aradix;
	int m=1,s=0;
	while(bradix>0){
		int digit=bradix%10;
		s=s+digit*m;
		m=m*2;
		bradix/=10;
	}
	double p=0;
	while(aradix>0){
		double digit=aradix%10;
		double term=digit/2;
		p=p/2+term;
		aradix/=10;
	}
	double num=s+p;
	cout<<fixed;
	cout.precision(2);
	cout<<num;
}

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{
	int a,b;
	cin>>a>>b;
	int i = 0;
	int sum = 0;
	while(a*pow(2,i) >= pow(10,i)){
		int p;
		p = a%2;
		a = a/2;
		sum = sum + p*pow(2,i);
		i = i + 1;
		}
        float sum2 = 0;
        int p=0;
	while(b > pow(10,i)){
	p = p+1;
	i = i+1;
	}
	int q;

	while(-1 < p){
	q = b/pow(10,p);
	sum2 = sum2 + q*pow(2,(-(i + i)));
	i = i+1;
	p = p-1;}
       	


	float sum3;
	sum3 = sum + sum2;
	cout<<" "<<sum3;
	}

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){
	for (int i = 0; a>0; i++){
		int remainder=0;
		remainder = remainder + (a%10)*pow(2,i);
		a = a/10;
	}
	return remainder;
}
int decimal(int 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: 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 convert_integral(int a)
{
	int twopoweri=1;
	int decimal=0;
	while(a!=0)
	{
		decimal=decimal+(a%10)*twopoweri;
		a=a/10;
		twopoweri=twopoweri*2;
	}
	return decimal;
}

float convert_fractional(int b)
{
	float twopoweri=0.5, decimal=0;
	int b_reverse=0;
	while(b!=0)
	{
		b_reverse=b_reverse*10+b%10;
		b=b/10;
	}
	while(b_reverse!=0)
	{
		decimal=decimal+twopoweri*(b_reverse%10);
		twopoweri=twopoweri/2;
		b_reverse=b_reverse/10;
	}
	return decimal;
}

main_program
{
	int integral, fractional;
	cin>>integral>>fractional;
	int decimal_integral=convert_integral(integral);
	float decimal_fractional=convert_fractional(fractional);
	float decimal= decimal_integral+decimal_fractional;
	cout.precision(2);
	cout<<fixed<<decimal;
}

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 k,brad,arad;
	int sum = 0;
	int i=0;

	cin >> brad >> arad ;

	while(brad!=0) {
	 k = brad%10;
	 sum = sum + k*pow(2,i);
	 brad = brad/10;
	 i++;
	}
	
	int n;
	n=-1;
	float k1,deci;
	deci=0;
	while(arad!=0) {
		k1 = arad%10;
		deci = deci + k1*pow(2,n);
		arad=arad/10;
		n--;
	
	}
	float tot;
	tot=sum+deci;

	cout<<fixed;
	cout.precision(2);
	cout<< tot  <<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: 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 reverse(int n){
	int reverse=0;
	
	while(n>0){
		int r=n%10;
		reverse=reverse*10+r;
		n/=10;
	}
	return reverse;
}

int integer(int n){
	int sum=0;
	int i=1;
	while(n>0){
	int r=n%10;
	sum+=r*i;
	i*=2;
	n/=10;
	}
	return sum;
	}

double decimal(int n){
	int k=reverse(n);
	double sum=0;

	double i=0.5;
	while(k>0){
		double r=k%10;
		sum+=r*i;
		i*=0.5;
		k/=10;
	}
	return sum;
}




main_program{
	int n,m;
	cin>>n>>m;
	cout<<fixed;
	cout.precision(2);
	cout<<integer(n)+decimal(m)<<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>

int intbin(int num) 
{
	int sum = 0;
	for(int i = 1; num > 0; i*=2)
	{
		if(num%10 == 1)
			sum += i;

		num /= 10; 
	}

	return sum;
}

double fracbin(int num)
{
	int temp = num;
	int nod = 0;       // nod stands for number of digits
	while(num > 0)
	{
		nod++;
		num /= 10;
	}
	num = temp;
	double sum;
	for (double i = pow(2,(-nod)); num > 0 ; i*=2)
	{
		if (num%10 == 1)
			sum += i;

		num /= 10;
	}
	return sum;
}

main_program
{
	int x, y; 
	cin >> x >> y;

	double integer = (double)intbin(x);
	double fraction = fracbin(y);

	double binary = integer + fraction;
	
	cout << binary << 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>
int inr(int a){
	int isum=0;
	for(int i=1;a>0;i=i*2){
		isum=isum+(i*a%10);
		a=a/10;
	}
	return isum;}
float fra(int b){
	float fsum=0;
	if(b==0){fsum=0;}
	else{int i=1000000000;
		while(b/i==0){i=i/10;}
		for(float j=0.5;b>0;j=j/2){
	    			fsum=fsum+j*(b/i);
	      	 		b=b-i;
	       			i=i/10;
       }}
       return fsum;}
main_program{
	int a,b;
	cin>>a>>b;
	float sum=inr(a)+fra(b);
	cout << fixed; // uses fixed floating point representation
	cout.precision(2); // print two digits after the decimal point
	cout<<sum;
}

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, b ;
	cin >> a >> b ;
	int x = 10, p = 0, i = 1 ;

	while (a >= 1){
		p = p + (i*(a%x)) ;
		i = i*2 ;
		a = a/10 ;
	}

	double q = 0.000, j = 0.500 ;
	int y = 100 ;
	while (b >= 0){
		int c = b/y ;
		q = q + (j*c) ;
		j = j/2 ;
		b = b - 100*c ;
		y = y/10 ;
	}

	cout << fixed ;
	cout.precision(2) ;
	cout << p+q ;
}

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{
	int a,b;
	cout<<"Enter value of number before radix point:";
	cin>>a;
	cout<<"Enter value of number after radix point:";
	cin>>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>
main_program{

	int a,b;
	cin >>a>>b;
	int na=0,nb=0;

	while(a!=0){
		a=a/10;
		na++;
	}
	while(b!=0){
		b=b/10;
		nb++;
	}
	int term;
	term= a*pow(10,nb) + b;
	int i= na+nb-1;
	int x,y,z;

	repeat(na+nb){
		x=term%10;
		term=term/10;
		y=x*pow(10,i);
		i--;
	}

	double sum=1.0;
	y=y/10;

	repeat(na+nb-1){
		z=y%10;
		y=y/10;
		if(z==0){sum=sum*2.0;}
		if(z==1){sum=(sum*2.0)+1.0;}
	}

	
	repeat(nb){
		sum/=2;}

	cout<<fixed;
	cout.precision(2);
	cout<<sum;
}

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