a very simple program and easy to understand that how to Use array in function. reverse function will reverse the array
#include<iostream.h>
const int row =3;int read(int a[row]);
int display(int a[row]);
int reverse(int a[row]);main(){
int a[row];
cout"User Input\n";
read(a);
cout"\nSame Values"endl;
display(a);
cout"\nRevered array\n";
reverse(a);
coutendl;
system("pause");
}
int read(int a[row]){
int i;
for(i=0; i<3; i++){
cout"\nEnter Number :";
cin>>a[i];
}
}
int display(int a[row]){
int i;
for(i=0; i<3; i++){
cout"\nNumber :"a[i][0];
}
}
int reverse(int a[row]){
int i;
for(i=3-1; i>=0; i--){
cout"\nRevered :"a[i];
}
}
if the given code doesn't work then download the .cpp file given below
Tags:
is code mn eight errors hn ,,plz chk it
cout undeclared
endl undeclared
kia in sb ko main s phly declare krna ho ga???kesy?
hifzah jab ning py code share kia jata hy to cout or cin k less then or greater then primary expression remove ho jaty hen wo lagao then execute ho ga or agr profect code chahiye to file b attach hy wo download kro
and this is my humble request to Sir M.Tariq Malik that please fix this issue from new threads
ni badsha m n jo file attach h us mn s hi kh rhi hn k errors hn
plz chk again
fixed now check kren
hifzah bcz there iz no value wch functionz wll return.
hifzah use return i; in all functionz.
I correctd errorz;
Now check it;
#include<iostream>
using namespace std;
// badshah.hazor@gmail.com
const int row =3; // global variable
// declaration of function
int read(int a[row]);
int display(int a[row]);
int reverse(int a[row]);
int main(){
cout"\t\t***Badshah***\n\n";
int a[row];
cout"User Input\n";
read(a); // calling to a function
cout"\nSame Values"endl;
display(a);
cout"\nRevered array\n";
reverse(a);
coutendl;
system("pause");
}
// definations of functions
int read(int a[row]){
int i;
for(i=0; i<3; i++){
cout"\nEnter Number :";
cin>>a[i];
}
return i;
}
int display(int a[row]){
int i;
for(i=0; i<3; i++){
cout"\nNumber :"a[i];
}
return i;
}
int reverse(int a[row]){
int i;
for(i=3-1; i>=0; i--){
cout"\nRevered :"a[i];
}
return i;
}
an excellent girl you are
thankuu فقیھہ اقدس
ap ny kon c file attach ki hy yaha pr to show nai ho rahi again attach kro
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We are user-generated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post