Answer to Question #20913 in C++ for zaima hussain

Question #20913
write a program in c++ that will input random floating values in an array using an user defined functions. Using another user defined functions search user input floating point number in the input array, the program output the position of the number in the array otherwise display a message that the number is not in the list.
1
Expert's answer
2012-12-20T07:34:29-0500

#include <iostream>
#include <conio.h>
#include <time.h>
using namespace std;

//main function
int main()
{
srand (time (NULL));
int arraofnumbers[100];

for(int i=0;i<100;i++){
arraofnumbers[i]=rand()1;
}


int number=0;
cout<<"Enter number: ";
cin>>number;
for(int i=0;i<100;i++){
if(number==arraofnumbers[i]){
cout<<arraofnumbers[i]<<" ";
}
}
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS