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]
2 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]2 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
____ involves taking data from your database and putting it into an electronic file in a format that another external applicatio
steposvetlana [31]

Answer:

The answer is "Option c".

Explanation:

In the database dumping a folder for configuration, which information in the file is called a document spill.  In Plesk, exporting a database dump is a file that can be used for storage or delivery, and then preserves a source database is known as Exporting, and other choices are not correct, that are described as follows:

  • Importing, It is a dump in a database, that includes retrieving data from the data in a database location, that's why it's wrong.
  • Enhancing, It automatically improves data, that's why it's wrong.
  • Extracting, It is used in data analyzing and trapped to obtain necessary data from sources, that's why it is wrong.
3 0
3 years ago
Think of an example in your life where a number could be described as data, information, and knowledge
zhannawk [14.2K]

Answer:

how many event you have been too in the last month (well non during this time but as an example)

Explanation:

4 0
2 years ago
In the context of IT jobs in the information systems field. A ____ is responsible for database design and implementation
Yuri [45]

Answer: Database Administrator.

A Database Administrator is responsible for any design and implementation of a database in a system. They are also the people who make sure that they can secure and manage all the data in their system to avoid any problems that may occur during its usage.

They also are responsible for keeping track of changes and the accessibility of the users that will be inputting data into the database. This most especially applies to databases that are meant to keep client information and transactions for most companies.

8 0
2 years ago
Read 2 more answers
What is the distinction between a network and an internet?
kompoz [17]
Hi,

Network: Is group of computers connected together via communications devices and transmission media.

Internet: Is a worldwide collection of networks that connect Governments, Businesses, Institutions and Individuals thought their personal devices.

Hope this helps.

r3t40
8 0
3 years ago
How many times would the code in this loop repeat? ____________ for ( j = 0; j &lt; 10; j++ ) { appendItem (myList, aNumber); }
Musya8 [376]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The for-loop given in the question is:

for ( j = 0; j < 10; j++ )

{

      appendItem (myList, aNumber); //this loop append a number to a list myList

}

This loop starts from J variable's value zero and when J's value is less than 10, the loop iterate through its body until J's value becomes greater or equal to 10. As J's value exceed nine, the loop will get terminated.

So this loop repeats 10 times its loop body, at the 11th time, the condition becomes false and the loop will get terminated.

4 0
2 years ago
Other questions:
  • Given positive integer numInsects, write a while loop that prints that number doubled without reaching 200. Follow each number w
    8·1 answer
  • A corporation needs an operating system that allows the various teams in its office to network and collaborate on projects. Whic
    14·1 answer
  • IF ACCURATE = BRAINLY (if u answer rubbish randomness= reported AND if you got questions dont ask in answer slot= reported)
    13·1 answer
  • A network administrator identifies sensitive files being transferred from a workstation in the LAN to an unauthorized outside IP
    12·1 answer
  • A major difference between digital librarians and traditional librarians is that traditional librarians rarely work with people.
    15·2 answers
  • Where can you find your EFC
    8·2 answers
  • What is internet marketing??
    13·1 answer
  • In a three-tier architecture, the component that runs the program code and enforces the business processes is the:_______.
    11·1 answer
  • It is where your cpu (processor) is installed
    10·2 answers
  • Keira is creating an app for her cross-country team. Users will input their race times and the output will be a graph showing th
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!