4.20-4.24 Programming Basics end, UID course

Source: Internet
Author: User

The effect of string functions is realized by other means, such as comparing array characters, displaying string lengths, copying strings, and so on. When comparing strings, the first is to compare the length of the string, when the length of the same time at different positions one by one corresponding character comparison size. With respect to the character length is the return value return count; The count represents the subscript at a different position on the array, and the IF (a[count]== ' s) stops the loop returning a return count when a position on the array is 0. Copying a string is done by looping through each bit on the array.

The UID course mainly explains the basic use of PS and the skill of shortcut keys. This main auxiliary page structure to build the approximate layout, first of all to imitate some of the more famous domestic sites, through a reasonable collocation design to achieve the personalization and practicality of the website.

int main ()
{

Char a[10] = "Hello";
Char b[] = "Hello";

void Stringcopy (char A[],char b[]);
void Stringconcat (char A[],char b[]);
int stringcmp (char A[],char b[]);
Stringcopy (A, b);
Stringconcat (A, b);
int re = stringcmp (A, b);
printf ("%d", re);
Puts (a);



}

Comparing strings

int stringcmp (char A[],char b[])
{
int i=0;
for (;; i++)
{
if (a[i]== ' &&b[i]== ')
{
return 0;
}
else if (a[i]== ' && b[i]!= ')
{
return-1;
}
else if (b[i]== ')
{
return 1;
}


if (a[i]-b[i]!=0)
{
return a[i]-b[i];
}
}
}

String length

int GetLength (char a[])
{
int count=0;
for (;;)
{
if (a[count]== ')
{
return count;
}
count++;
}
}

Copy string

void Stringcopy (char A[],char b[])
{
int i=0;
for (;; i++)
{
A[i]=b[i];
if (b[i]== ')
{
Break
}
}

}

Link
void Stringconcat (char A[],char b[])
{
/*
int i;
for (i=0;; i++)
{
if (a[i]== ')
{
Int J;
for (j=0;;)
{
a[i++] = b[j++];
if (b[j]== ')
{
Return
}
}

}
} */


int i;
for (i=0;; i++)
{
if (a[i]== ')
{
Break
}
}

int j=0;
for (;; J + +)
{
a[i++] = B[j];
if (b[j]== ')
{
Break
}
}

}

4.20-4.24 Programming Basics end, UID course

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.