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
ddd [48]
2 years ago
14

c++ 4.17 LAB: Count characters 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. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not exactly 1. Ex: If the input is: n Monday the output is: 1 n
Computers and Technology
1 answer:
Nata [24]2 years ago
5 0

Answer:

#include <iostream>

using namespace std;

int main() {

   int n = 0;

   char c;

   string str;

   cin >> c >> str;

   for (int i = 0; i < str.length(); ++i)

       if (c == str[i]) n++;

   cout << n << " n" << (n > 1 ? "'s" : "");

   return 0;

}

Explanation:

Declares variables n, c, and str.

Next a loop lets count number of character c in string str.

Finally, answer is showing.

You might be interested in
What is the difference between keywords and identifiers in c++ ?
prohojiy [21]
Keywords are the reserved words of a language.Identifiers are the user defined names of variable, function and labels. Hope that this helped
3 0
3 years ago
Define stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name()" followed
elena-14-01-66 [18.8K]

Answer:

Replace your solution goes here with the following:

def compute_avg(num1, num2):

   func_name = "compute_avg()"

   print("FIXME: "+func_name)

   return -1

def get_user_num(user_num):

   func_name = "get_user_num()"

   print("FIXME: "+func_name)  

   return -1  

Explanation:

This defines the compute_avg function

def compute_avg(num1, num2):

This sets the function name

   func_name = "compute_avg()"

This prints the required output

   print("FIXME: "+func_name)

This returns -1

   return -1

This defines the get_user function

def get_user_num(user_num):

This sets the function name

   func_name = "get_user_num()"

This prints the required output

   print("FIXME: "+func_name)

This returns -1  

   return -1  

4 0
3 years ago
As the project manager for a software development project, you are helping to develop the project schedule. You decide that writ
Jobisdone [24]

Answer:

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

Explanation:

That form of dependency helps the project or development team to maximize the development process via the growth cycle of that same venture.

  • It is used by managers of the project to establish a "balance" on the timeline.
  • It has also been known as the system which makes use of the largest and most successful quality methods dependent on the team experience.

So, using this type of dependency is far better.

7 0
3 years ago
HOW DO I CONNECT TO MY mysql server on my computer locally using php and also how to run it on the browser
zhuklara [117]

Answer:

<?php

$mysqli = new mysqli("127.0.0.1:3307", "myUser", "myPass", "databasename");

$query = "SELECT * FROM users ORDER BY name";

if($result = $mysqli->query($query))

{

   echo '<ul>';

while ($obj = $result->fetch_object())

   {

       echo '<li>'.$obj->name.'</li>';

   }

   $result->free();

   echo '</ul>';

}

else

{

   die("nothing found");

}

$mysqli->Close();

?>

Explanation:

This should get you started.

7 0
3 years ago
Quadratic equation 4
SSSSS [86.1K]

In algebra, a quadratic equation is any equation that can be rearranged in standard form as ax^{2}+bx+c=0 where x represents an unknown, and a, b, and c represent known numbers, where a ≠ 0. If a = 0, then the equation is linear, not quadratic, as there is no ax^2 term.

HOPE IT HELPS:)

7 0
3 years ago
Other questions:
  • David would like to send a letter to more than one hundred people. He would like the letter to have names and addresses inserted
    7·1 answer
  • What are the requirements of a data dictionary ?
    7·2 answers
  • In microsoft word, when you highlight existing text you want to replace you are
    10·1 answer
  • Client computers cannot function unless they are connected to the network because they cannot access an operating system.
    7·1 answer
  • To reduce inflation, the Federal Reserve _____ the money supply. This action also causes the economy to shrink.
    13·2 answers
  • Copy the skeleton of code below into your answer. Then in the space indicated, add your own code to prompt the user for two numb
    8·1 answer
  • 1.5 question 3 on edhesieve
    6·1 answer
  • What is the user requirements of an educational app
    15·1 answer
  • (b) In Scratch, the instruction 'when I receive' enables us to _____ the action of multiple sprites ​
    5·1 answer
  • What does it mean by does the author create an emotional connection toward the readers?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!