1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ivann1987 [24]
3 years ago
10

LAB: Count characters - methods

Computers and Technology
1 answer:
tangare [24]3 years ago
4 0

Answer:

i hope understand you

mark me brainlist

Explanation:

using namespace std;

#include <iostream>

 

#include <string.h>

#include <stdlib.h>

#include <stdio.h>

 

#define BLANK_CHAR (' ')

 

 

int CountCharacters(char userChar, char * userString)

{

 

int countReturn=0;

 

int n = strlen(userString);

 

for (int iLoop=0; iLoop<n; iLoop++)

{

       if (userString[iLoop]==userChar)

       {

        countReturn++;

 }

}

return(countReturn);

}

 

/******************************************

    Removes white spaces from passed string; returns pointer

     to the string that is stripped of the whitespace chars;

   

  Returns NULL pointer is empty string is passed;  

     Side Effects:

 CALLER MUST FREE THE OUTPUT BUFFER that is returned

 

 **********************************************************/

char * RemoveSpaces(char * userString)

{

 

 char * outbuff = NULL;

 

 if (userString!=NULL)

 {

   int n = strlen(userString);

    outbuff = (char *) malloc(n);

 

   if (outbuff != NULL)

   {

          memset(outbuff,0,n);

          int iIndex=0;

          //copies non-blank chars to outbuff

         for (int iLoop=0; iLoop<n; iLoop++)

         {

           if (userString[iLoop]!=BLANK_CHAR)

          {

           outbuff[iIndex]=userString[iLoop];

           iIndex++;

   }

   

   } //for

         

   }

   

   }

 return(outbuff);

 

}

 

 

int main()

{

 

 char inbuff[255];

 cout << " PLEASE INPUT THE STRING OF WHICH YOU WOULD LIKE TO STRIP WHITESPACE CHARS :>";

 gets(inbuff);

 

 char * outbuff = RemoveSpaces(inbuff);

 if (outbuff !=NULL)

 {

    cout << ">" << outbuff << "<" << endl;

    free(outbuff);

    }

     

   memset(inbuff,0,255);  

   cout << " PLEASE INPUT THE STRING IN WHICH YOU WOULD LIKE TO SEARCH CHAR :>";

gets(inbuff);

 

  char chChar;

 cout << "PLEASE INPUT THE CHARCTER YOU SEEK :>";

 cin >> chChar;

 

 int iCount = CountCharacters(chChar,inbuff);

 cout << " char " << chChar << " appears " << iCount << " time(s) in >" << inbuff << "<" << endl;

 

}

You might be interested in
The basics of color theory assume what central tenets
fomenos
Color has important psychological and visual effects on the audience
5 0
3 years ago
Which part of the Office interface is located across the top of the application window and organizes common features and command
aleksklad [387]

Answer:

The correct answer to the following question will be "Ribbon".

Explanation:

  • In the configuration of the computer interface, the ribbon is indeed a graphical controlling feature in the format of a series of toolbars mounted on several tabs. The standard ribbon layout requires large toolbars, loaded with graphical keys, tabbed as well as other visual control features, organized by feature.
  • The aim of the ribbon should be to provide quick and easy access to widely used activities for each system. The ribbon is therefore tailored for each task and includes program-specific commands. Besides, the top of a ribbon contains multiple tabs that can be used to disclose various groups of commandments.

Therefore, Ribbon it the suitable answer.

6 0
3 years ago
Which of the following functions needed to implement the information security program evaluates patches used to close software v
solong [7]

Answer:

a. Systems testing

Explanation:

According to my research on information technology, I can say that based on the information provided within the question the term being defined is called System Testing. Like mentioned in the question, this is a technique used in order to evaluate the complete system the system's compliance against specified requirements, which tests its functionalities from an end-to-end perspective in order to evaluates patches used to close software vulnerabilities and make sure it complies with all policies.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

6 0
3 years ago
______ is a slow process that takes place in nature. (2 points)
netineya [11]

Natural Selection.


♣Amaranthine
6 0
3 years ago
At the heart of every computing device is a(n) _______________, which is usually a single, thin wafer of silicon and tiny transi
SSSSS [86.1K]

Answer:

CPU

Explanation:

Central Processing UnitUnit

5 0
3 years ago
Other questions:
  • How do you open two different picture in photoshop?
    14·1 answer
  • A customer has a system with a Gigabyte B450 Aorus Pro motherboard. He wants to upgrade the processor from the AMD Athlon X4 950
    8·2 answers
  • Create a DisplayBox application that prompts the user for a height and width and then displays a box of that size. The DisplayBo
    8·1 answer
  • How do you get the value of an element in an array? And how about for an ArrayList?
    14·1 answer
  • When it's time to change career paths, it's a good idea to first​
    7·2 answers
  • Which of the following statements best describes the relative amount of content held by digital libraries vs. the amount held by
    12·1 answer
  • Could you please check my answers to this layout user defined data types
    15·1 answer
  • HURRY- I’ll give 15 points and brainliest answer!!
    10·2 answers
  • Help FAST PLS in complete sentences discuss the process used to determine your credit score. Do you think it is fair? Why or why
    14·1 answer
  • Do OBS mic filters apply everywhere? Such as discord and other apps similar. Or is it just on streaming?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!