Linear table Operations

Source: Internet
Author: User

/* Linear table is an ordered set of n elements (n≥0), n is the number of elements in a linear table, called the length of a linear table
。 You can store elements in a linear table in sequence using a contiguous set of storage cells, which are called sequential tables in a linear table.
Implement the operation on the sequential table, implement the inverse of the sequential table, and delete all elements in the table that have the value equal to X.
Input
Three sets of data, sequential table element types are integer, character, and real.
The first row of each group gives the number of elements N (0<n≤1000), the second row gives the element value, and the third line gives the element to be deleted.
Output
Three sets of data, the first row of each group gives the inverted order table element, and the second row is the order table element after the specified element is deleted on this basis
, each output element has a space after it, and if the element is all deleted, a blank line is output.
Sample input
8
1 2 3 7 5 6 7 8
7
3
A C m
H
4
1.2 3.4 5.6 7.8
1.2
Sample output
8 7 6 5 7 3 2 1
8 6 5 3 2 1
M c A
M c A
7.8 5.6 3.4 1.2
7.8 5.6 3.4
*/
#include <stdio.h>
#include <string.h>
#define N 1001
/*
void Inputint (int a[]);
void Inputchar (char c[]);
void Inputdouble (double f[]);
void Outputint (int a[],int n,int x);
void Outputchar (char c[],int M,char R);
void Outputdouble (double f[]), int p,double q);
*/
int main ()
{
int a[n];
Char C[n];
Double F[n];
int n,i,x,m,p;
Double T;
Char R;
scanf ("%d", &n);
for (i=0;i<n;i++)
scanf ("%d", &a[i]);
scanf ("%d", &x);
for (i=n-1;i>=0;i--)
printf ("%d", a[i]);
printf ("\ n");
for (i=n-1;i>=0;i--)
{
if (a[i]==x)
Continue
Else
printf ("%d", a[i]);
}
printf ("\ n");
scanf ("%d", &m);
for (i=0;i<m;i++)
C[i]=getchar ();
scanf ("%c", &r);
for (i=m-1;i>=0;i--)
printf ("%c", C[i]);
printf ("\ n");
for (i=m-1;i>=0;i--)
{
if (c[i]==r)
Continue
Else
printf ("%c", C[i]);
}
printf ("\ n");
scanf ("%d", &p);
for (i=0;i<p;i++)
scanf ("%lf", &f[i]);
scanf ("%lf", &t);
for (i=p-1;i>=0;i--)
printf ("%lf", F[i]);
printf ("\ n");
for (i=p-1;i>=0;i--)
{
if ((a[i]-t) <1e-6)
Continue
Else
printf ("%lf", A[i]);
}
return 0;
}

Have not learned C + +;

Linear table Operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.