Em Andamento

Lab 8 strlen strcpy strcat

/*

Project Description:

Purpose of Quiz/Lab #8

This quiz/lab activity is to demonstrate string manipulation in C and prepare you for the mid-term exam, so you can see what you will be asked to do on the exam in order to prepare for it.

REQUIRED Practice Problems:

Write the following functions, consistent with the prototypes shown:

1) int strlen(char* s);

Given a string, return the number of characters in the string, NOT INCLUDING the null at the end.

2) char* strcpy(char* s1, char* s2);

The function will copy the string s2 into the string s1. Note the function returns the address of the string.

3) char* strcat(char* s1, char* s2);

The function concatenates the string s2 into the end of string s1. If s1 is "Hello " and s2 is "World" before, after calling strcat, s1 will be "Hello World"

Lab Assignment #8

LAB Assignment:

Write main() functions to test and debug each function, using gets() and puts() for string input and output as follows:

A) To demonstrate strlen(), input your first name using gets() and use printf to print the string followed by the number of characters in the string. An input of "Yousef" would print 3. Show this with 3 string input examples.

B) To demonstrate strcpy(), input your first name using gets(s1) and use strcpy() to copy it to a second string, s2 and print both strings with puts(). So an input of "Yousef" would print: "string1 = Yousef string2 = Yousef".

C) To demonstrate strcat(), use gets() to input your first name, last name, and Red ID as three separate strings, print them out, one per line, concatenate the three strings, and then use puts() to print out Hello followed by your name and Red ID. If the three input strings entered are "Yousef" "AlKhatrash" and "817218071", then it should print:

Yousef

AlKhatrash

817218071

Hello Yousef AlKhatrash 817218071

*/

Habilidades: Programação C

Ver mais: strings programming, string problems, programming practice problems, programming practice, printf programming, practice programming problems, first lab, programming string functions, programming strcpy, programming quiz, programming printf, programming hello world, programming char, char programming, lab test, concatenate, number manipulation, programming project quiz, hello world null, string manipulation, programming lab, lab test programming, programming lab test, s1, line exam

Acerca do Empregador:
( 3 comentários ) San Diego, United States

ID do Projeto: #6780810

Premiar a:

urmate

A proposal has not yet been provided

$20 USD em 1 dia
(31 Avaliações)
4.2

1 freelancer está ofertando em média $20 para este trabalho

Imranceo

Hi there- My name is imran.I am highly Expert in this field. I'll provide you satisfaction. So your time and money will be safe when you will award me project. take a look at my Freelancer Portfolio

$30 USD em 1 dia
(16 Comentários)
4.2