
I dont understand how to solve these type of questions.
`Hey,
Note: If you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
#include <iostream>
using namespace std;
int main()
{
string s;
getline(cin,s);
int ct1=0,ct2=1,ct3=0,ct4=0,flag=1;
if((s[0]>='A'&&s[0]<='Z'))
ct3=1;
for(int i=0;i<s.length();i++)
{
ct1++;
if(s[i]==' ')
{
ct2++;
if((s[i+1]>='A'&&s[i+1]<='Z'))
ct3++;
flag=1;
}
if(flag==1&&i<s.length()-1)
{
if(s[i]==s[i+1])
{
ct4++;
flag=0;
}
}
}
cout<<"Number of characters are:
"<<ct1<<endl;
cout<<"Number of words in sentence are:
"<<ct2<<endl;
cout<<"Number of proper words in sentence are:
"<<ct3<<endl;
cout<<"Number of words with consecutive letters are:
"<<ct4<<endl;
return 0;
}

Kindly revert for any queries
Thanks.
I dont understand how to solve these type of questions. Q2. (25 marks) Write a C++...
please
write a C++ code
Problem A: Word Shadow Source file: shadow.cpp f or java, or.cj Input file: shadow.in in reality, when we read an English word we normally do not read every single letter of that word but rather the word's "shadow" recalls its pronunciation and meaning from our brain. The word's shadow consists of the same number of letters that compose the actual word with first and last letters (of the word) in their original positions while the...
I need my c++ code converted to MASM (assembly language). The instructions below: write an assembly program that does the following; 1. count and display the number of words in the user input string. 2. Flip the case of each character from upper to lower or lower to upper. For example if the user types in: "Hello thEre. How aRe yOu?" Your output should be: The number of words in the input string is: 5 The output string is : hELLO...
Using C++ programming. Write a program that takes a string of input from the user and separates the string of words based on the premise that the string contains words whose first letter is uppercase. Then, display the phrase (or sentence) to a string in which the words are separated by spaces and only the first word of the phrase starts with an uppercase letter. For example, if the user enters "IAmTheTeacher", then the program would display: "I am the...
Write a Java Program that performs the following functionalities: and you can use if statements, cases, and string methods Enter a new main sentence Find a String Find all incidents of a String Find and Replace a String Replace all the incidents of a String Count the number of words Count a letter’s occurrences Count the total number of letters Delete all the occurrences of a word Exit The program will display a menu with each option above, and then...
using basic c++ and use no functions from c string library
b) Write a fragment of code (with declarations) that reads a pair of words from the keyboard and determines how many letters in corresponding positions of each word are the same. The words consist only of the letters of the English alphabet (uppercase and lowercase). For example, if the words are coat and CATTLE, the following output should be generated: 012245 0122 matching letter in position 0 t is...
Write a program that reads in a sentence of up to 100 characters and outputs the sentence with spacing corrected and with letters corrected for capitalization. In other words, in the output sentence, all strings of two or more blanks should be compressed to a single blank. The sentence should start with an uppercase letter but should contain no other uppercase letters. Do not worry about proper names; if their first letters are changed to lowercases, that is acceptable. Treat...
I need help writing this C code. Here is the description: Let's say we have a program called smart typing which does two things: The first letter of a word is always input manually by a keystroke. When a sequence of n letters has been typed: c1c2...cn and the set of words in the dictionary that start with that sequence also have c1c2...cnc then the smart typing displays c automatically. we would like to know, for each word in the dictionary,...
Question 2 (80 marks)
This programming assignment is divided into two parts:
(a) You will develop a Java class called StringSummary based on
the UML class diagram depicted in Figure 1
A user will enter a string of sentence (Figure 2), and your
program will provide a
summary of the sentence as shown in sample output Figure 3.
The class contains several private attributes:
• str stores the sentence input by user.
• specialChars stores number of special characters (i.e....
Hello! i need a program in C that uses FILE*! The instructions are below! Please dont copy paste another chegg post! Thank you! Will leave positive review! I need a program that 1) Count all words in a file. A word is any sequence of characters delimited by white space or the end of a sentence, whether or not it is an actual English word. 2)Count all syllables in each word. To make this simple, use the following rules: •Each...
2. This question is about processing strings 2.1 [4 marks] Given a string str, we can calculate a checksum of the string by summing up the ASCII codes of the characters in the string. For example, the checksum of a string "apple" is 530, which equals to 'a' + 'p' + 'p' + 'l' + 'e' = 97 + 112 + 112 + 108 + 101. Write a function int calculate_checksum(char str[] that calculates and returns the checksum of the...