Start New Discussion within our Software Development Community
class StudentMark
{
public:
	 
	   StudentMark();

	   StudentMark(double);
	   double getGrade();
};
#include"grade.h"
#include<iostream>
using namespace std;
StudentMark::StudentMark()
{
	double mark=0.0;
}
/*StudentMark::StudentMark(double dNewmark)
{  
   dmark=dNewmark;
}*/
StudentMark::StudentMark
{
	if(mark>=80&&mark=<100)

		grade='A';
	
else
	 
	if(mark>=75&&mark<80)

        grade='A-';

else

	if(mark>=70&&mark<75)

		grade='B+';

else
	
	if(mark>=65&&mark<70)
         grade='B';

else 


	if(mark>=60&&mark<65)

		grade='B-';

else 


	if(mark>=55&&mark<60)

		    grade='C+';
	
else 
 
	
	if(mark>=45&&mark<55)

		grade='C-';
	
else 

	if(mark>=40&&mark<45)

		grade='D';

else 
		grade='F';

	StudentMark::getGrade()
		return grade;
	}
#include<iostream>
#include"grade.h"
#include<string.h>
using namespace std;

int main(void)
{

	   StudentMark studentmark1(60.0);
	   StudentMark studentmark2(75.5);
	   StudentMark studentmark3(89.9);

	cout<<"Your Mark is "
		<<studentmark1.StudentMark<<"your Grade is"<<  studentmark1.getGrade<<endl;
	
	return 0;
}

this is my code and i still hv some error,the error show is like this

1>c:\users\teoh\documents\visual studio 2008\projects\lab1iii)\lab1iii)\grade main.cpp(14) : error C2274: 'function-style cast' : illegal as right side of '.' operator
1>grade.cpp
1>c:\users\teoh\documents\visual studio 2008\projects\lab1iii)\lab1iii)\grade.cpp(13) : error C2470: 'StudentMark::{ctor}' : looks like a function definition, but there is no parameter list; skipping apparent body
how i must do to solve this problem

Comments
Learn how to read the error output yourself. It's really not that difficult.
Use code tags.

The compile time errors tell you exactly how to fix the problem. And a closer look at your code also shows you that you've made in mistake with your constructors.

This article has been dead for over six months. Start a new discussion instead.