hey guys i need some help please. i have to do this for hw Write a program that finds and displays a max number in the array of 10 integer numbers. Also, sort that array in ascending order and display it on the screen. so far this is what i have so far
#include <stdio.h>
#include <iostream>
#include <algorithm>
#define MAX 10
int a[MAX];
int main()
{
int array[]={23,5,-10,0,0,321,1,2,99,30};
int elements=sizeof(array);
std::sort(array,array+elements);
int i,j;
for (i=0; i < MAX; i++)
{
a=i;
printf("%d\n",a);
}
for (j=0;j< MAX-1; j++)
{
printf("please enter number>");
scanf("%d",&a);
}
printf("%d\n");
for (i=0; i < MAX; i++)
printf("%d\n",a);
for (int i=0; i<elements;++i)
std::cout<<array<<' ';
return 0;
}
but when i compile it its still wrong. can someone help me please?
#include <stdio.h>
#include <iostream>
#include <algorithm>
#define MAX 10
int a[MAX];
int main()
{
int array[]={23,5,-10,0,0,321,1,2,99,30};
int elements=sizeof(array);
std::sort(array,array+elements);
int i,j;
for (i=0; i < MAX; i++)
{
a=i;
printf("%d\n",a);
}
for (j=0;j< MAX-1; j++)
{
printf("please enter number>");
scanf("%d",&a);
}
printf("%d\n");
for (i=0; i < MAX; i++)
printf("%d\n",a);
for (int i=0; i<elements;++i)
std::cout<<array<<' ';
return 0;
}
but when i compile it its still wrong. can someone help me please?