4 errors, please indicate errors.

Feb 3, 2013 at 3:07pm
#include <iostream.h>
#include <conio.h>
//#include <stdlib.h>

main()
{
void diplay (void);
clrscr();

display();

cout<<"ok";

//getch();

}
void display (void)
{
cout<<"It is my first Function program"<<endl;
}
Feb 3, 2013 at 3:41pm
Seems like a homework problem... Why don't you first try for yourself?
Feb 3, 2013 at 4:20pm
You declared function as

void diplay (void);

But called functiobn
display();

That is their names do not coinside.

I hope that your old compiler allows to omit return types of functions.

Otherwise you shall declare main as

int main()
Last edited on Feb 3, 2013 at 4:22pm
Feb 3, 2013 at 4:29pm
You misspelled display in line 7.
Watch this youtube video about functions and please learn some more C++

http://www.youtube.com/watch?v=endPDlcvoYM&list=UUdbHDXYdsHkqpyAt9Z4_iCw&index=4

Fixed code:
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
#include <iostream>
#include <windows.h>

using namespace std;

void display();       // Function prototyping


int main(){

display();   // You spelled diplay. You don't need to type void. You make a new function if you do that.
                 // What you did is called function overloading. Giving two or more functions the same name. 
                 // So if you want to call a function in main only use the function it's name!

// if you want you can use system("CLS"); here. You must include windows.h for that

cout << "Ok" << endl;

system("PAUSE");
return 0;
}

void display(){
cout << "This is my first function program!" << endl;

}


Last edited on Feb 3, 2013 at 4:43pm
Feb 3, 2013 at 4:58pm
Bundle of Thanks Great work
Feb 3, 2013 at 5:10pm
You're welcome (:
Topic archived. No new replies allowed.