| techboy (3) | |
|
#include <iostream> using namespace std ; int calcArea( int , int ) ; void display ( void ) ; int main () { int length , width , area ; cout << "please enter the length and width" << endl ; cin >> length >> width ; area = calcArea ( length , width ) ; display ( void ) ; return 0 ; } int calcArea ( int l , int w ) { return l * w ; } void display ( void ) { return "display the area" ; } THERE IS SOMETHING WRONG ON THIS CODE. I CAN'T RUN THIS PROGRAMME. | |
|
|
|
| Peter87 (3687) | |
| When you call the display you should not write void inside the parenthesis. | |
|
|
|
| upX86 (13) | |
Here you are returning constant character string from the function which has void as return type. Either you do not return any thing ( return; or //return "display the area" ; ) or change the return type (to char* display ( void ); in this example).
| |
|
Last edited on
|
|