CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: In this problem, you are required to write only two functions in the file implementation.cpp. A main program (main.cpp) is already provided and must not be modified.

Function 1: noOfDays

int noOfDays(int m)

Write a function named noOfDays that takes a single integer m (1 to 12 inclusive) and returns the number of days in that month for the year 2025.

You may refer to a calendar to determine the correct number of days for each month.

Examples:

noOfDays(7) must return 31  
noOfDays(2) must return 28  

When this function is called:
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Function 2: oneWeekLater

int oneWeekLater(int d, int m)

Write another function named oneWeekLater which MUST USE the function noOfDays.

This function takes two integers:
- d represents the day.
- m represents the month.

The function should return a single integer representing the day (between 1 and 31) that occurs exactly 7 days after the given day and month.

Examples:

oneWeekLater(20, 8) must return 27  
oneWeekLater(24, 2) must return 3  

Explanation:
- 27 August is 7 days after 20 August.
- 3 March is 7 days after 24 February.

When this function is called:
- Argument d is guaranteed to be between 1 and 31.
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Main Program

A main program (main.cpp) is already provided. It reads the day and month from input and calls the functions noOfDays and oneWeekLater with appropriate arguments.

You must only implement the required functions in implementation.cpp.

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the answers.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
int noOfDays(int m){
   if(m==1 || m==3 || m==5 || m==7 ||  m==8 || m==10 || m==12){
      return 31;}
   if(m==4 || m==6 || m==9 || m==11){
    return 30;}
   else{return 28;}
}
int oneWeekLater(int d,int m){
    int D=noOfDays(m);
    if(D - d >=7){
        return d + 7;
    }
    if(D - d< 7){
        return 7 - D + d;
    }

}

Grading criterion: Function noOfDays: Declaration and header
Rating A: Correctly declares the function and definition i.e. correct return type along with the name of the function and its arguments

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: In this problem, you are required to write only two functions in the file implementation.cpp. A main program (main.cpp) is already provided and must not be modified.

Function 1: noOfDays

int noOfDays(int m)

Write a function named noOfDays that takes a single integer m (1 to 12 inclusive) and returns the number of days in that month for the year 2025.

You may refer to a calendar to determine the correct number of days for each month.

Examples:

noOfDays(7) must return 31  
noOfDays(2) must return 28  

When this function is called:
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Function 2: oneWeekLater

int oneWeekLater(int d, int m)

Write another function named oneWeekLater which MUST USE the function noOfDays.

This function takes two integers:
- d represents the day.
- m represents the month.

The function should return a single integer representing the day (between 1 and 31) that occurs exactly 7 days after the given day and month.

Examples:

oneWeekLater(20, 8) must return 27  
oneWeekLater(24, 2) must return 3  

Explanation:
- 27 August is 7 days after 20 August.
- 3 March is 7 days after 24 February.

When this function is called:
- Argument d is guaranteed to be between 1 and 31.
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Main Program

A main program (main.cpp) is already provided. It reads the day and month from input and calls the functions noOfDays and oneWeekLater with appropriate arguments.

You must only implement the required functions in implementation.cpp.

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the answers.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
int noOfDays(int m){
        if(m<1 || m>12)
                return  ;
        else if (m=1 || m=3 || m=5 || m=7 || m=8 || m=10 || m=12)
                return 31 ;
        else if (m=2)
                return 28 ;
        else if (m=4 || m=6 || m=9 || m=11)
                return 30 ;}
int oneWeekLater(int d,int m){
        if (noOfDays(m)=28 && (d+7)>28)
                return (d+7)-28;
        else if (noOfDays(m)=28 && (d+7)<28)
                return 28-(d+7);
        else if (noOfDays(m)=30 && (d+7)<30)
                return 30-(d+7);
         else if (noOfDays(m)=30 && (d+7)>30)
                 return (d+7)-30;
         else if (noOfDays(m)=31 && (d+7)<31)
                  return 31-(d+7);
           else if (noOfDays(m)=31 && (d+7)>31)
                     return (d+7)-31;

Grading criterion: Function noOfDays: Declaration and header
Rating A: Correctly declares the function and definition i.e. correct return type along with the name of the function and its arguments

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: In this problem, you are required to write only two functions in the file implementation.cpp. A main program (main.cpp) is already provided and must not be modified.

Function 1: noOfDays

int noOfDays(int m)

Write a function named noOfDays that takes a single integer m (1 to 12 inclusive) and returns the number of days in that month for the year 2025.

You may refer to a calendar to determine the correct number of days for each month.

Examples:

noOfDays(7) must return 31  
noOfDays(2) must return 28  

When this function is called:
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Function 2: oneWeekLater

int oneWeekLater(int d, int m)

Write another function named oneWeekLater which MUST USE the function noOfDays.

This function takes two integers:
- d represents the day.
- m represents the month.

The function should return a single integer representing the day (between 1 and 31) that occurs exactly 7 days after the given day and month.

Examples:

oneWeekLater(20, 8) must return 27  
oneWeekLater(24, 2) must return 3  

Explanation:
- 27 August is 7 days after 20 August.
- 3 March is 7 days after 24 February.

When this function is called:
- Argument d is guaranteed to be between 1 and 31.
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Main Program

A main program (main.cpp) is already provided. It reads the day and month from input and calls the functions noOfDays and oneWeekLater with appropriate arguments.

You must only implement the required functions in implementation.cpp.

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the answers.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include <simplecpp>

int noOfDays(int m);{
cin >> m;
   m<=12 && m>=1;
          if (( m= 1|| m=3 || m=5 || m=7 || m=8 || m=10 || m=12);
                cout <<"31");
               else if ( m=2;
                cout << "28");
             else if (( m= 4|| m=6 || m=9 || m=11);
               cout << "30");




}
int oneWeekLater(int d, int m);{
cin >> d >> m;
       if ( d=d+7<= noOfDays(m);
           cout << "d+7");
            else if (( d=d+7> noOfDays(m));
                     cout << d+7-noOfDays(m));





}

main_program
{
    int day, month;
    cin >> day >> month;
    cout << noOfDays(month) << " " << oneWeekLater(day, month) << endl;
}

Grading criterion: Function noOfDays: Condition to check the number of days in the month
Rating A: Correctly checks the condition for the number of days in the month and appropriately sets the value to be returned

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: B
Problem: In this problem, you are required to write only two functions in the file implementation.cpp. A main program (main.cpp) is already provided and must not be modified.

Function 1: noOfDays

int noOfDays(int m)

Write a function named noOfDays that takes a single integer m (1 to 12 inclusive) and returns the number of days in that month for the year 2025.

You may refer to a calendar to determine the correct number of days for each month.

Examples:

noOfDays(7) must return 31  
noOfDays(2) must return 28  

When this function is called:
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Function 2: oneWeekLater

int oneWeekLater(int d, int m)

Write another function named oneWeekLater which MUST USE the function noOfDays.

This function takes two integers:
- d represents the day.
- m represents the month.

The function should return a single integer representing the day (between 1 and 31) that occurs exactly 7 days after the given day and month.

Examples:

oneWeekLater(20, 8) must return 27  
oneWeekLater(24, 2) must return 3  

Explanation:
- 27 August is 7 days after 20 August.
- 3 March is 7 days after 24 February.

When this function is called:
- Argument d is guaranteed to be between 1 and 31.
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Main Program

A main program (main.cpp) is already provided. It reads the day and month from input and calls the functions noOfDays and oneWeekLater with appropriate arguments.

You must only implement the required functions in implementation.cpp.

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the answers.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
int noOfDays(int m)
{
        int n;
        if(m>7)
        {
                if(m%2==0)
                {
                        n=31;
                }
                else
                {
                        n=30;
                }
        }
        else
        {
                if(m==2)
                {
                        n=28;
                }
                else if(m%2==0)
                {
                        n=30;
                }
                else
                {
                        n=31;
                }
        }
        return n;
}

    int oneWeekLater(int d,int m)
{
        int k;
        k=noOfDays(m);
        int n=d;
        for(int i=0;i<7;i++)
        {
                n++;
                if(n>k)
                {
                        n=1;
                }
        }
        return n;
}

Grading criterion: Function noOfDays: Condition to check the number of days in the month
Rating A: Correctly checks the condition for the number of days in the month and appropriately sets the value to be returned

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: In this problem, you are required to write only two functions in the file implementation.cpp. A main program (main.cpp) is already provided and must not be modified.

Function 1: noOfDays

int noOfDays(int m)

Write a function named noOfDays that takes a single integer m (1 to 12 inclusive) and returns the number of days in that month for the year 2025.

You may refer to a calendar to determine the correct number of days for each month.

Examples:

noOfDays(7) must return 31  
noOfDays(2) must return 28  

When this function is called:
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Function 2: oneWeekLater

int oneWeekLater(int d, int m)

Write another function named oneWeekLater which MUST USE the function noOfDays.

This function takes two integers:
- d represents the day.
- m represents the month.

The function should return a single integer representing the day (between 1 and 31) that occurs exactly 7 days after the given day and month.

Examples:

oneWeekLater(20, 8) must return 27  
oneWeekLater(24, 2) must return 3  

Explanation:
- 27 August is 7 days after 20 August.
- 3 March is 7 days after 24 February.

When this function is called:
- Argument d is guaranteed to be between 1 and 31.
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Main Program

A main program (main.cpp) is already provided. It reads the day and month from input and calls the functions noOfDays and oneWeekLater with appropriate arguments.

You must only implement the required functions in implementation.cpp.

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the answers.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include <simplecpp>

void noOfDays(int m=month);
void oneWeekLater(int d=day, int m=month);

main_program{
    int day, month;
    cin >> day >> month;
    cout << noOfDays(month) << " " << oneWeekLater(day, month) << endl;
}

Grading criterion: Function noOfDays: Condition to check the number of days in the month
Rating A: Correctly checks the condition for the number of days in the month and appropriately sets the value to be returned

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: C
Problem: In this problem, you are required to write only two functions in the file implementation.cpp. A main program (main.cpp) is already provided and must not be modified.

Function 1: noOfDays

int noOfDays(int m)

Write a function named noOfDays that takes a single integer m (1 to 12 inclusive) and returns the number of days in that month for the year 2025.

You may refer to a calendar to determine the correct number of days for each month.

Examples:

noOfDays(7) must return 31  
noOfDays(2) must return 28  

When this function is called:
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Function 2: oneWeekLater

int oneWeekLater(int d, int m)

Write another function named oneWeekLater which MUST USE the function noOfDays.

This function takes two integers:
- d represents the day.
- m represents the month.

The function should return a single integer representing the day (between 1 and 31) that occurs exactly 7 days after the given day and month.

Examples:

oneWeekLater(20, 8) must return 27  
oneWeekLater(24, 2) must return 3  

Explanation:
- 27 August is 7 days after 20 August.
- 3 March is 7 days after 24 February.

When this function is called:
- Argument d is guaranteed to be between 1 and 31.
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Main Program

A main program (main.cpp) is already provided. It reads the day and month from input and calls the functions noOfDays and oneWeekLater with appropriate arguments.

You must only implement the required functions in implementation.cpp.

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the answers.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
int noOfDays(int n)
{
	if (n>0 && n<=12){
		if (n==1 || n==3||n==5||n==7||n==8||n==10||n==12){
			n=31;}
		else if(n==4||n==6||n==9||n==11){
			n=30;}
		else
			n=28;
	}
	return n;}
int oneWeekLater(int m, int n)
{
	m=m+7;
	if ((n==1 || n==3||n==5||n==7||n==8||n==10||n==12) && m<31){
		return (m,n);}
	else if ((n==1 || n==3||n==5||n==7||n==8||n==10||n==12) && m>31){
		m=m-31;
		n=n+1;
		if (n>12){
			n=n-12;
			return (m,n);}
		else
			return (m,n);}
	else if ((n==4||n==6||n==9||n==11)&& m<30){
		return (m,n);}
	else if ((n==4||n==6||n==9||n==11) && m>30){
		m=m-30;
		n=n+1;
		return (m,n);}
	else if (n ==2 && m>28){
		m=m-28;
		n=n+1;
		return (m,n);}
	else if (n==2 && m<28){
		return (m,n);}
}

Grading criterion: Function noOfDays: Condition to check the number of days in the month
Rating A: Correctly checks the condition for the number of days in the month and appropriately sets the value to be returned

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: B
Problem: In this problem, you are required to write only two functions in the file implementation.cpp. A main program (main.cpp) is already provided and must not be modified.

Function 1: noOfDays

int noOfDays(int m)

Write a function named noOfDays that takes a single integer m (1 to 12 inclusive) and returns the number of days in that month for the year 2025.

You may refer to a calendar to determine the correct number of days for each month.

Examples:

noOfDays(7) must return 31  
noOfDays(2) must return 28  

When this function is called:
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Function 2: oneWeekLater

int oneWeekLater(int d, int m)

Write another function named oneWeekLater which MUST USE the function noOfDays.

This function takes two integers:
- d represents the day.
- m represents the month.

The function should return a single integer representing the day (between 1 and 31) that occurs exactly 7 days after the given day and month.

Examples:

oneWeekLater(20, 8) must return 27  
oneWeekLater(24, 2) must return 3  

Explanation:
- 27 August is 7 days after 20 August.
- 3 March is 7 days after 24 February.

When this function is called:
- Argument d is guaranteed to be between 1 and 31.
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Main Program

A main program (main.cpp) is already provided. It reads the day and month from input and calls the functions noOfDays and oneWeekLater with appropriate arguments.

You must only implement the required functions in implementation.cpp.

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the answers.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>

int noOfDays(int m){
   if(m == 2) {
     m = 28;} 
   else if ( m == 1 ||  m == 3 || m == 5 || m == 7 || m == 8 || m == 10  || m == 12) {
     m = 31;}
   else {
    m = 30;}
    return m;
      }
      
int oneWeekLater(int d, int m) {
      if( d + 7 <= noOfDays(m) ) {
        d = d + 7; }
      else {
      d = d + 7 - noOfDays(m);
      }
      return d;
      }

Grading criterion: Function noOfDays: Condition to check the number of days in the month
Rating A: Correctly checks the condition for the number of days in the month and appropriately sets the value to be returned

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A
Problem: In this problem, you are required to write only two functions in the file implementation.cpp. A main program (main.cpp) is already provided and must not be modified.

Function 1: noOfDays

int noOfDays(int m)

Write a function named noOfDays that takes a single integer m (1 to 12 inclusive) and returns the number of days in that month for the year 2025.

You may refer to a calendar to determine the correct number of days for each month.

Examples:

noOfDays(7) must return 31  
noOfDays(2) must return 28  

When this function is called:
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Function 2: oneWeekLater

int oneWeekLater(int d, int m)

Write another function named oneWeekLater which MUST USE the function noOfDays.

This function takes two integers:
- d represents the day.
- m represents the month.

The function should return a single integer representing the day (between 1 and 31) that occurs exactly 7 days after the given day and month.

Examples:

oneWeekLater(20, 8) must return 27  
oneWeekLater(24, 2) must return 3  

Explanation:
- 27 August is 7 days after 20 August.
- 3 March is 7 days after 24 February.

When this function is called:
- Argument d is guaranteed to be between 1 and 31.
- Argument m is guaranteed to be between 1 and 12.

--------------------------------------------------

Main Program

A main program (main.cpp) is already provided. It reads the day and month from input and calls the functions noOfDays and oneWeekLater with appropriate arguments.

You must only implement the required functions in implementation.cpp.

--------------------------------------------------

Note

- Do not print any extra messages such as:
  cout << "Enter a number"
  cout << "The computed answer is"
- Use cout only to print the computed final output.
- Do not print unnecessary spaces.
- Do not hard-code the answers.
- If any test case passes by simply printing output without logic, marks will not be awarded.

Student submission:
#include<simplecpp>
int noOfDays(int m){
                     if (m==1||m==3||m==5||m==7||m==8||m==10||m==12){return 31;}
                     else if (m==4||m==6||m==9||m==11){return 30;}
                    else {return 28;}
}

int oneWeekLater(int d, int m){
                       int b=0;
                       if(d+7<=noOfDays(m)){return d+7;}
                       if(d+7>noOfDays(m)){b=(d+7)-noOfDays(m);
                       return b;}
                       }

Grading criterion: Function noOfDays: Condition to check the number of days in the month
Rating A: Correctly checks the condition for the number of days in the month and appropriately sets the value to be returned

Rating B: Some issue. 

Rating C: Major issue. 

Rating D: 0
Assigned grade: A