program not compiling .help plizz

Jun 10, 2013 at 7:28am
any one can help me
my program cannot compile.

i dont know why..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  #include <iostream>
#include <stdlib.h>

using namespace std;

int getmark();
char computeGrade();

int main()
{
    int mark = getmark();
	char Grade = computeGrade();
	cout<<Grade;
	
	
	system ("PAUSE");
	return 0;
}
int getmark()
{
 	int mark;
	cout<<"enter mark";
	cin>>mark;
	return mark;
}

char computeGrade(double marks)
{
	int mark;
	
	if ((mark>85) && (mark<100))
	   cout<<'A';
	else if((mark>75) && (mark<84))  
		 cout<<'B';
    else if ((mark>65) && (mark<74))
		 cout<<'C';  
}
Jun 10, 2013 at 7:38am
your functions doesnt have oppening and closing brackets.
Jun 10, 2013 at 7:45am
sir on which line ..u min the curly braces ??
Jun 10, 2013 at 7:51am
starting ones at 10 and 20, yes
Last edited on Jun 10, 2013 at 7:57am
Jun 10, 2013 at 8:04am
don't know whether fmehri76 is just trolling...

the problem is that the function computeGrade() does not match the prototype on line 7.

By the way: the local variable on line 29 doesn't make sense. Replace double marks with int mark. Don't forget to adjust line 7. Then pass mark from line 11 to the function computeGrade(mark) on line 12
Jun 10, 2013 at 8:20am
Why should I troll?! Im on a mobile phone so maybe it is rendered with some problem in my browser. Anyway I should check it in my pc. Sorry for giving wrong info.
Jun 10, 2013 at 8:30am
hey its ok dont trouble yr self.fmehri76
Jun 10, 2013 at 9:02am
hey,this would be the correct version of your program.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <stdlib.h>
using namespace std;

int getmark(void);
char computeGrade(int);

int main()
{
    int mark = getmark();
    char Grade = computeGrade(mark);
    cout<<"\n the grade is:";
    cout<<"\n"<<Grade;
	
	
	//system ("PAUSE");
	return 0;
}
int getmark()
{
 	int mark;
	cout<<"enter mark";
	cin>>mark;
	return mark;
}

char computeGrade(int mark)
{
	
	if ((mark>85) && (mark<100))
	   return 'A';
	else if((mark>75) && (mark<84))  
		return 'B';
    else if ((mark>65) && (mark<74))
		return 'C';  
}


also, you'll have to test the logic of your program.if you input mark as 85 you shall not get any grades output as you haven't checked for mark==85 anywhere in computegrade(), you're only checking for mark>85 and mark<84!@
Last edited on Jun 10, 2013 at 9:03am
Jun 10, 2013 at 9:47am
ohhww thanks very much sir now i know where i went wrong..thanks very very much for yr help..
Topic archived. No new replies allowed.