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 whole, decimal, i=0, integer = 0;
	float point = 0.00;
	cin >> whole >>  decimal;
	while(whole>0)
	{
		integer += (whole%10)*(pow(2,i));
		whole = whole/10;
		i++;
	}
	int r=0;
	while( decimal >= pow(10,r))
	{
		r++;
	}
	if(decimal == pow(10,r))
	{
		r++;
	}
	while(decimal >0)
	{
		point += (decimal%10)*(pow(2,-r));
		decimal = decimal/10;
		r--;
	}
	cout << fixed;
	cout.precision(2);
	cout << integer + point << 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>

float int_binary_part( int int_input) 
{
	int int_result=0;
	int i = 0;
	while(int_input>0) {
		int remainder = int_input%10;
		int_result = int_result + remainder*pow(2,i);
		i++;
		int_input/=10;
	}
	return int_result;
}

float fraction_binary_part(int frac_input) {
	int no_of_terms;
	cin >>no_of_terms;
	float frac_result = 0.0;
	int i= no_of_terms;
	while(i>=1) {
		int remainder = frac_input%10;
		frac_result+= remainder*pow(2,-i);
		i--;
		frac_input/=10;
	}
	return frac_result;
}




main_program
{
	int int_input , frac_input;
	cin >> int_input >> frac_input;
	cout << int_binary_part(int_input)+fraction_binary_part(frac_input);

}

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 integer(int p){
	int sum=0;
	int fact=10;
	int x=p;
	int i=0;
	while((x/fact)!=0){
		sum=sum+(x%fact)*pow(2,i);
		x=x/10;
		i=i+1;
	}
	sum=sum + x*pow(2,i);
	return sum;
}
float fraction(int q){
	float sum=0;
	sum=sum+(q/100)*pow(2,-1);
	q=q%100;
        sum=sum+(q/10)*pow(2,-2);
       q=q%10;
        sum=sum+q*pow(2,-3);
        return sum;	
}
main_program{
	int a,b;
	cin>>a>>b;
	float sum;
	sum=integer(a)+fraction(b);
	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: 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 intBinary(int a){
	int ans =0, t=1;
	while(a>0){
		ans += (a%10)*t;
		t *= 2;
		a /= 10;
	}
	return ans;
}
int rev(int a){
	int ans=0;
	while(a>0){
		ans = ans*10 + (a%10);
		a /= 10;
	}
	return ans;
}
double decBinary(int b){
	int a = rev(b);
	double ans =0 , t =0.5;
	while(a>0){
		ans += (a%10) *t;
		t *= 0.5;
		a /= 10;
	}
	return ans;
}
main_program{
	int a,b;
	cin>>a>>b;
	double total = intBinary(a) + decBinary(b);
	cout<<total;
}

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 val(int a){
int count=1, ans = 0;
        while(True){
                if(a > pow(10,count)){
                        count++;
                }
                else{
                                break;}
	}
	for (int i = 0; i <= count; i++){
		ans = ans + a%10*pow(2,i);
		a=a/10;
	}
	return ans;
}
	
double decimal(int b){
	double ans = 0;
	int count=1;
	while(True){
		if(b > pow(10,count)){
			count++;
		}
		else{
				break;}
	}

	for(int i = count;i>0;i--){
		ans = ans + (b%10)*pow(0.5,i);
		b = b/10;
	}
	return ans;	
}

main_program{
	int x, y;
	cin >> x >> y;
        cout << fixed;
	cout.precision(2);	
	cout << val(x)+decimal(y);
}

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

	int *p=&x;
	int k=0,sum=0,tpd=10,term=0;
	while(*p>0){
		term=(*p%tpd);
		sum=((term)*pow(2,k))+sum;
		k=k+1;
		*p=*p/10;
	}
	return sum;
}
int B2d(int &X){
	int *P=&X;
	for(N=1,(*P/10)>0,*P=*P/10){
		N++}
	int *P=&X;
	int n=N-1;
	    int Tdp=pow(10,n);
	    int Term=0;
	    int K=-1;
	    float Sum =0;
	while(*P>=0){
		Term=(*P/Tdp);
		Sum=((Term)*pow(2,K))+Sum;
		K=K-1;
		*P=*P-(Term*Tdp);
		Tdp=Tdp/10;
		if (*P==0) break;
	}
	int n=N-1;
	return Sum*(pow(10,n));
}


main_program{
	int x,y,X,Y;
	cin>>x>>X;
	y=b2d(x);
	Y=B2d(X);
	cout<<y<<"."<<Y;
}

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

void integer(int a,int &b){
	int remainder;
	while(a>1){
		remainder=a%2;
		a=a/2;
		b=b*10+remainder;}
}

void fraction(int c, double &d){
}

int main(){
	int w,x=0,y;
	double z=0;
	cin>>w>>y;
	integer(w,x);
	fraction(y,z);
	cout<<fixed;
	cout.precision(2);
	cout<<x+z;
}

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 intpart(int m){

	int dec=0,i=1,temp;
	dec+=m%10;
	while(m/pow(10,i)!=0){
		temp=m/pow(10,i);
		dec+=(temp%10)*pow(2,i);
		i++;
	}

return dec;
}

double fracpart(int n){

	float dec=0,i=1;
	int digits=0,temp;
	while(n/pow(10,digits)!=0){
		digits++;
	}
	dec+=(n%10)*pow(2,-digits);
	repeat(digits){
		temp=n/pow(10,i);
		dec+=float((temp%10))*pow(2,-digits);
		digits--;
	}
	return dec;
}

main_program{
	int m,n;
	cin>>m>>n;
	int ans;
	ans=double(intpart(m))+fracpart(n);
	cout<<ans;
	cout.precision(2);
}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
main_program{
	float x1,x2;
	int r1=1,r2=2,r3=3;
	cin>>x1>>x2;
	if (0<x1,x2<1){
		cout<<r1<<endl;
	}
	else if (1<x1,x2<2){
		cout<<r2<<endl;
	}
	else
	{
		cout<<r3<<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{
	float x;
	int p;
	cin>>x;
	p=int(x);
	while(p>0){
		cout<<(p%2);
		p=p-(p%2);
		if (p==0){
			break;
		}
	}
	cout<<fixed;
	
}

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 f1(int a){
	int sum=0, i=0;
	while(a>0){
		int r;
		r=a%10;
		sum = sum+r*pow(2,i);
		a=a/10;
		i++;
	}
	return sum;
}

double f2(int b){
	int sum2=0, j=-1;
	int n=10,i=2;
	while(true){
		if(b<=n){
		for( ;abs(j)<=n ; ){
		
			int s=(b%10)*pow(2,j);
			sum2 += s;
			j=j-1;
		}break;}
		else n=n*10;
		
	}
		
	return sum2;
}

int main(){
	int a, b;
	cin>>a>>b;
	int integer=f1(a);
	double decimal=f2(b);
	double ans= integer+decimal;
	cout<<fixed;
	cout.precision(2);
	cout<<ans;
}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
double binarytodecimal( int&a ,int&b );
main_program
{
	int a , b;
	cin>>a>>b;
	
	cout<<fixed;
	cout.precision(2);
	cout<< binarytodecimal(  a , b );
	
	
	}
double binarytodecimal( int&a ,int&b )
{
	int leftpart=0 , term =1;
	
	while(a !=0)
	{
		
		leftpart+=term*(a%10);
		a=a/10;
		term*=2;
	}
	double rightpart =0 , t =1;
       int n =b;
	while( n!=0)
	{
		t/=2;
		n=n/10;
	}
	while( b!=0)
	{
		rightpart+=t*(b%10);
		b=b/10;
		t*=2;
	}
	
	
	return leftpart+rightpart;
	}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
  float f(int x){
	 int i=0;
	 float z=0;
	 float y;
	 while(x>0){
		 y=x%10;
                 z=z+y*pow(2,i);
		 i++;
		 x=x/10;}
	  return z;}
 float g(int p){
            int l=0;
            float q;
            float r=0;
	    int z=p;
	    while(z>0){
		    z=z/10;
		    l--;}

		    
	    
            while(p>0){
                  q=p%10;
                  r=r+q*pow(2,l);
                  l++;
                  p=p/10;}
	     return r;}
                      		  
	 main_program{
		 int x, p;
		 cin>>x>>p;

cout << fixed; // uses fixed floating point representation
cout.precision(2); // print two digits after the decimal point
	 cout<<f(x)+ g(p);}

Grading criterion: is a seperate function called for binary integer part ?
Rating A: if a seperate function is called and returned the value to main function
Rating B: if seperate function is not called or directly written in main function
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to convert a binary number (that may contain a fractional part) into its corresponding decimal value. The program should take two binary values as input, one representing the number before the radix point and the other representing the number after the radix point. The program should convert the binary values into their corresponding decimal values and print the resulting value rounded to two decimal places. The program should use functions to convert the integer and fractional binary parts into integer and double values, respectively, and add the integer and double values to obtain the final decimal value. The program should use the cout statement to print the resulting value with two digits after the decimal point.

Student submission:
#include<simplecpp>
 int binaryint( int x){
	 int ans = 0, i = 0;
	 do{
		int term = 0 ;
		term = x%10;
		ans = ans + term*pow(2,i);
		x = x/10;
		i = i + 1;
 	 }
	 while(x/10 != 0);
	 ans = ans + x*pow(2,i);
	 return ans;
 }

 double binarydec( int y){
 	double ans = 0;
	int z=1;
	int t; 
	t = y;
	while (t/10 != 0){
		t = t/10;
		z= z+1;
	
	} 
	do{
		double term = 0;
		term = y%10;
		ans = ans + term*pow(2,-z);
		y = y/10;
		z = z- 1;
	}while (y%10 != 0);
	
	ans = ans + y/2;
	return ans; 
 }

main_program{
	int a, b;
	cin >> a >> b;
	cout<< fixed;
        cout.precision(2); 
	cout << binaryint(a) + binarydec(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>
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: 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