0% found this document useful (0 votes)
19 views

CSC425_Function_additionalNotes_VoidFunctionWithNoParameters

Uploaded by

Muhammad Al-azim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

CSC425_Function_additionalNotes_VoidFunctionWithNoParameters

Uploaded by

Muhammad Al-azim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

using namespace std;


//declaration of the function @ function prototype
void hello(void);
void line(void);

int main()
{

/*
===============================
hello
hello
hello
=============================== */

//user defined function


//caller only exist in the main program

line();
for (int x=0;x<3;x=x+1)
{
hello(); //reusable
}
line();

return 0;

//function definition
void hello()
{

cout << "\n\t Hello ";


return;

void line()
{
cout << "\n ========================";
return;

}
/* Write a complete program to display the following output
Welcome to ABC Transport Sdn Bhd --- > function header()
********************** --- > function star()

list of Menu --- > function menu()


1. Nasi Goreng
2. Nasi Ayam
3. Mee Goreng
Please make your choice */
#include <iostream>

using namespace std;


//function declaration
void header(void);
void star(void);
void menu(void);

int main()
{
//caller
header();
star();
menu();
return 0;
}

//function definition
void header()
{
cout << "\n Welcome to ABC Transport Sdn Bhd ";
return;
}

void star()
{
cout << "\n **************************** ";
return;
}

void menu()
{
cout << "\n list of Menu ";
cout << "\n 1. Nasi goreng " ;
cout << "\n 2. Nasi ayam " ;
cout << "\n 3. Mee goreng ";
cout << "\n 4. Mee kuah ";
cout << "\n 5. Bihun sup ";
cout << "\n Please make your choice : ";
return;
}

You might also like