Use c-strings without using the c-string library

Assignment Help C/C++ Programming
Reference no: EM13159796

write a program that implementd and test the following functions for use C-strings without using the c-string libaray ( that is, you re NOT ALLOWED to use #include <cstring> in this   program):

int strcompare(const   char *s1, const   char *s2);
The   strcompare function   performs   a   comparison   of   s1   to   s2.   It   starts   with   the   first   character   in   each   string  
and   continues   with   subsequent   characters   until   the   corresponding   characters   differ   or   until   the   end   of   the  
strings   is   reached.   strcompare   returns   a   value   that   is:  
  
< 0       if   s1   is   less   than   s2,  
== 0       if   s1   is   the   same   as   s2,   or  
> 0       if   s1   is   greater   than   s2.
  
More   precisely,   if   the   strings   differ,   the   value   of   the   first   nonmatching   character   in   s2   subtracted   from   the  
corresponding   character   in   s1   is   returned.     

unsigned long strlength(const char *str);
The strlength   function   calculates   the   length   of   str.   Returns   the   number   of   characters   in   str,   not   counting  
the   terminating   null   character

Test   Run:
Enter string 1: cats rule
Enter string 2: DOGS DROOL
string 1 is 9 characters long.
string 2 is 10 characters long.
string 2 lexicographically comes before string 1.

 

 

Reference no: EM13159796

Questions Cloud

Which of the following is not a feature of epithelium : Which of the following is NOT a feature of epithelium?
Operating system that supports a one-to-one relationship : Given an operating system that supports a one-to-one relationship between user-level threads and kernel-level threads and allows one or more threads from a process to issue blocking system calls while other threads (within that process) continue to r..
It should have an if statement : The following are hints given: It should have an if statement. This add method determines what number greater than or less than the other number, than it adds the positive or negative. I think this should be a private method.
Write a regression model : Describe the effect of this change in units on the estimated regression coefficients and their standard errors, t and F-statistics, p-values, and the value of R 2 .
Use c-strings without using the c-string library : write a program that implementd and test the following functions for use C-strings without using the c-string libaray  ( that is, you re NOT ALLOWED to use #include in this   program):
Bond ammortization schedule using effective interest method : Prepare journal entry to record the issuance of the bonds and the related bond issue costs incurred January 1, 2009. Prepare a bond ammortization schedule up to and including January 1, 2013 using effective interest method
Boolean variable called wantstoppings : After reading the input character, the program shall assign a value to a Boolean variable called  wantsToppings ( true  for a customer who wants toppings,  false  for a customer who does not).
Report of client-s request by summarizing research : Write a 1,050- to 1,400-word paper that addresses your client's request by summarizing research from the FASB Accounting Standards Codification website and other sources.
What is an allele : What is the krebs cycle and where does it take place andwhat does it do?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Complete the design and implementation

Complete the design and implementation of the class customerType defined in the Programming Example Video Store. b. Design and implement the class customerListType to create and maintain a list of customers for the video store.

  Write the code

Write a program that allows an instructor to keep a grade book. Each students has scores for exams, homework assignments, and quizzes.

  Determine order in which constructors of class will execute

Suppose that an object of class three enters its scope, so the constructors of theses classes will execute. Determine the order in which the constructors of these classes will execute.

  Program to enter number of values to be processed

Write c++ statements to permit the user to enter n, the number of values to be processed; then assign the anonymous array of n double values, storing its address in doublPtr.

  Draws a single level for a "rogue­like" computer game

You will write a program that draws a single level for a "Rogue­like" computer game. The program will parse a line of input text from an input file (room.txt), use the parsed text to determine the shape of the room and its contents and then draw the ..

  Write a complete c++ program

The main program will read in a parameter value n (read this in main). Then it will call a function read2arrays (details below) to read lists of grades into two arrays, which the main program will call test1 and test2 (or some other names of your ..

  Write a loop that fills a vector

Write a loop that fills a vector V with ten  different  random numbers between 1 and 100. output must actually display the random numbers to get credit.

  Prepare a linux shell

Prepare a linux shell (in other words, write a C/C++ program) that will recursively prompt for input from the user. The shell should prompt as

  Write a matrix multiplication program

Write a C++, matrix multiplication program which you can instrument to monitor and measure execution time as a function of problem size. Make sure it works in Microsoft Visual Studio.

  A constructor and a destructor

A constructor and a destructor, Insert a new element chosen by the user at the correct place in the list

  Prepare a program that uses the pthread library

Prepare a C/C++ program that uses the PTHREAD library to create threads and mutexes to synchronize them.

  Write c program for linked list applications

Write a complete C program which illustrates the Linked list applications data structures and algorithms. The program will read in mid-semester test scores as Main Linked List and produce six outputs:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd