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
Ghella [55]
3 years ago
14

Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in

the string.
Ex: If the input is:

n Monday
the output is:

1
Ex: If the input is:

z Today is Monday
the output is:

0
Ex: If the input is:

n It's a sunny day
the output is:

2
Case matters.

Ex: If the input is:

n Nobody
the output is:

0
n is different than N.





This is what i have so far.
#include
#include
using namespace std;

int main() {

char userInput;
string userStr;
int numCount;

cin >> userInput;
cin >> userStr;

while (numCount == 0) {
cout << numCount << endl;
numCount = userStr.find(userInput);

}
return 0;
}
Computers and Technology
1 answer:
nevsk [136]3 years ago
5 0
Here is a Python program:

tmp = input().split(' ')
c = tmp[0]; s = tmp[1]
ans=0
for i in range(len(s)):
if s[i] == c: ans+=1

# the ans variable stores the number of occurrences
print(ans)
You might be interested in
Refer to the exhibit, a technician applies the configuration in the exhibit to an unconfigured router. To verify the configurati
pentagon [3]

Answer:

E. Enable secret 5 $1$v0/3$QyQWmJyT7zCa/yaBRasJm0 enable password 7 14141E0A1F17 line console 0 password 7 020507550A

Explanation:

The cisco ios is the operating system of any cisci network device. It is a command line interface used to configure these cisco devices.

The privilege user command "show running-config" in the command line interface is used to show the current configuration on the RAM of the router.

There are two ways to protect the router's console line with a password, with enable secret and enble password. The "enable secret" is a slightly encrypted password but the "enable password" has no encryption. These password methods are used to secure any channel to the router.

The "service password-encryption" command is used to encrypt all the passwords in the current configuration, to prevent attackers or unauthorized users from getting to the router.

7 0
4 years ago
If you need to add more data between column C and column D, you should _____.
lina2011 [118]
Right click on the line separating the two columns, and you should be able to select "add column"
4 0
4 years ago
Which header provides functions that deal with exceptional conditions?
Lyrx [107]

Answer:

<exception> header provides functions for exception handling in c++.

Explanation:

Exceptions gives a way to respond to exceptional conditions (like runtime errors) in codes by transferring the control to other special functions called handlers. Since try,catch and throw can work in the iostream header file.To use more functions like unexpected,current_exception,rethrow_exception we need exception header file.

3 0
4 years ago
HELPPP!! Ghost_diary
Elena-2011 [213]

Answer:

manga or an anime a a a a a a a a

8 0
3 years ago
In preparing categorical variables for analysis, it is usually best to​ Select one:
Allushta [10]

Answer:

a. convert the categories to numeric representations

Explanation:

6 0
3 years ago
Other questions:
  • Explain Spreadsheet and its Basics
    13·1 answer
  • The measure of how quickly things may be converted to something of value is called.
    10·2 answers
  • What is most important to print out and keep offline?
    12·2 answers
  • What is the page table mainly for?
    8·1 answer
  • A photographer stores digital photographs on her computer. In this case the photographs are considered the data. Each photograph
    6·1 answer
  • I found a brand-new charger wire still in its plastic package, but it's six years old and has never been used. Is it safe to use
    9·1 answer
  • Declare a struct of your choice (Employee, Student etc). Delcare a node for singly link list. Declare an ADT of this linklist. T
    7·1 answer
  • What year was the first release of a linux operating system?
    7·1 answer
  • The formula in cell C9 is B9*F10. On copying this formula to cell Z9, what will be the formula​
    5·1 answer
  • Consider the following method:
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!