searching and sorting help!!!

any one know what im doing wrong?

#include <iostream>
#include <string>
#include <iomanip>

using namespace std;

int array [20];
int count;
int number;
int counta;
int countb;

int main ()
{
int array [20] = {9, 18, 27, 36, 54, 45, 99, 63, 108, 72, 3, 6, 12, 15, 21, 24, 30, 33, 39, 42};
cout << " please pick one of the following numbers to search for" << endl;
for (count = 0, count ++, count <20);
{
cout << array[count] << "";
count = count++;
}

cin >> number;
int linearsearch (number [], count = 0, count ++);
{
counta = counta++;
if number = array{count}
{
cout << "the number is in memory position " << count << endl;
cout << "it took " << count << "passes to find it" << endl;
}
else
{
cout << " the number is not in memory position " << count << endl;
}


cout <<"the numbers in ascending order are :" << endl;



for (count = 0, count ++, count <20);

That's wrong. I'm guessing you meant this:

for (count = 0; count < 20; count ++)
Note that the semi-colon at the end goes AFTER the actual contents of the for loop.

Why does your for loop contain
count = count++;
when you've already got count++ at the top Do you realise that count++ changes the value of count? There's no point in saying count=count++ as the count++ changes the value.

You need to stop and go back to whatever you're learning from, and start again. You've misunderstood so many things and got so much syntax wrong.

if number = array{count}
Did you mean
if (number == array[count]) ?
So many mistakes in just that.
Topic archived. No new replies allowed.