найти ошибку Язык си
#include
struct list
{
int n;
list*next;
}
list*f_el(int n)
{
list*t=new list;
t=>n=n;
t=>next=0;
return t;
}
void ins(list*h, int N)
{
list*p; list*c;
p=h; c=h->next;
while (c!=0)
{
if (c->n next;
}
list*t=f_el(N);
t->next=p->next;
p->next=t;
}
void pr(list*h)
{
for (h->next;h!=0;h=h->next)
printf("%d\n",h->n);
}
int main ()
{
list*h=new list;
h=>n=0;
h=>next=0;
int n;
printf ("Vvedite znachenie\n");
scanf("%d",&n);
while(n!=0)
{
ins(h,n);
printf("Vvesite 4islo\n");
scanf("%d",&n);
}
pr(h->next);
return 0;
}
#include <iostream>
int main()
{
using namespace std;
int N;
cout << "Enter N: ";
cin >> N;
int num;
int max = 1;
int i;
for (i = 0; i < N; ++i)
{
cout << "Enter #" << i + 1 << " number: ";
cin >> num;
if ((num - 9) % 10 != 0 && num % 3 == 0)
{
max = num;
break;
}
}
for (int j = i + 1; j < N; ++j)
{
cout << "Enter #" << j + 1 << " number: ";
cin >> num;
if ((num - 9) % 10 != 0 && num % 3 == 0)
if (num > max)
max = num;
}
if (max != 1)
cout << "Max number div by 3 and don't end 9: " << max << endl;
else
cout << "No numbers div by 3 and don't end 9" << endl;
return 0;
}