class StudentMarks
{
public:	   
         int Marks;
	     StudentMarks();
		StudentMarks(int iMarks);
        char grade();
        


};   
#include"grade.h"
#include<iostream>
using namespace std;
StudentMarks::StudentMarks(int)
{
	int iMarks=0;
}
/*StudentMark::StudentMark(int iStudentNewmark)
{  
   iStudentmark=iStudentNewmark;*/

char StudentMarks::getgrade()
{
	  
		  if(iMarks>=80 && iMarks<=100)
	   {
		    return 'A';
	   }
		  
		 else
		   if(iMarks>=75 && iMarks<80)
		   {
			   return 'A-';
		   }
       else
		   if(iMarks>=70 && iMarks<75)
		   {
			  return 'B+';
		   }
       else
		   if(iMarks>=65 && iMarks<70)
		   {
			   return 'B';
		   }
       else
	  
		   if(iMarks>=60 && iMarks<65)
		   {
                 return 'B-';

		   }

	  else
		     if(iMarks>=55 && iMarks<60)
		   {
			   return 'C+';
			 }
	 else

		    if(iMarks>=50 && iMarks<55)
		   {
			   return 'C';
			}
		else
            if(iMarks>=45 && iMarks<50)
		   {
			   return 'c-';
			}
			
			else
				  
		      if(iMarks>=40 && iMarks<45)
		   {
			   return 'D';
			  }

			  else
				     if(iMarks>=0&& iMarks<40)
		   {
			   return 'F';
				 }


}
#include<iostream>
#include"grade.h"
#include<stdlib.h>
using namespace std;

int main()
{

	   StudentMarks StudentMarks1(65);
	   StudentMarks StudentMarks2(75);
	   StudentMarks StudentMarks3(89);
      
	
	   
	     cout<<"your marks is"<<StudentMarks1.iMarks<<" your Grade is"<< StudentMarks1.getgrade()<<endl;
		 cout<<"your marks is"<<StudentMarks2.iMarks<<" your Grade is"<< StudentMarks2.getgrade()<<endl;
		 cout<<"your marks is"<<StudentMarks3.iMarks<<" your Grade is"<< StudentMarks3.getgrade()<<endl;
	



	return 0;
}

why my output is like this your marks is 65 your grade is p
who can explain to me...how to correct it

your code is very, very, very, very, very, hard to follow because you did not use code tags when you posted your code. The result is your code that is not indented, looks like regular text, and contains smiley faces.

i suspect you are trying to return a char in a function that is prototyped to return a unknown type, but that's just a guess because i can't read your code. it's too jumbled up and messy. If your function is prototyped to return a char, 'B+' for example, would exceed the capacity of a char. Suitable alternatives include use of cstrings or string class objects.

Here is an example of code that uses code tags:

#include<iostream>

using namespace std;

int main()
{
     cout << "Hello world.";

     return 0;
}

compare to posting without code tags:

#include<iostream>

using namespace std;

int main()
{
cout << "Hello world.";

return 0;
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.