Answer:
This local distributed systems identification and authentication computer system networks describe centrally support facilities.
Explanation:
Identification is the process of identify employ, student and others is associated with a other entity, identify is associated by always that a person,id number and they personal id.
Identification number is assigned to the employee and students an administration system identification entities such as departments, roles, computer base service.
Identification is the number to perform regular faculty staff as defined in the register.
Authentication is the secure identification system of users,all users computer system and network must develop implement control policies.
Authentication responsible for the determining method to use among that available for a particular system,provide by standard organization then using the authentication method system.
Authentication policy apply to the transactions routing school and office area transmission by administrative offices, transaction is crucial to conduct of university business.
Which recovery method helps users boot into an environment to get them back into the system so they can begin the troubleshooting process
Answer:
sfadasda
Explanation:
dsadasdadas
Questions: 1) Sequential pattern mining is a topic of data mining concerned with finding statistically relevant patterns between data examples where the values are delivered in a sequence. Discuss what is sequential data
Answer and Explanation:
The sequential data or sequence data is described as data that come in an ordered sequence. It may also be termed data that is produced from tasks that occurs in sequential order The sequential pattern mining is a critical subject in data mining that has do with applying sequential data to derive a statistically relevant pattern from it.
Sequential pattern mining is a part of data mining. Data mining involves utilizing data from databases to understand and make decisions that better the organization or society as a whole based on this. Common data mining tasks include: clustering, classification, outlier analysis, and pattern mining.
Pattern mining is a kind of data mining task that involves explaining data through finding useful patterns from data in databases. Sequential pattern mining is pattern mining that uses sequential data as a source of data in finding data patterns. Sequential pattern mining applies various criteria(which maybe subjective) in finding "subsequence" in data. Criteria could be :frequency, length, size, time gaps, profit etc. Sequential pattern mining is commonly applicable in reality since a sizeable amount of data mostly occur in this form. A popular type of sequential data is the time series data.
(Process scores in a text file) Suppose that a text file contains an unspecified number of scores. Write a program that reads the scores from the file and displays their total and average. Scores are separated by blanks. Your program should prompt the user to enter a filename. Here is a sample run:
Answer:
Here is the Python program:
def scores(file): # method scores that takes a file name as parameter and returns the sum and average of scores in a file
with open(file, 'r') as infile: # open the file in read mode
lines = [score.split() for score in infile] # split the scores into a list
print("The scores are:",lines) #print the scores
for line in lines: # loops through each score
total= sum(int(score) for score in line) # adds the scores
average =total/len(line) # computes average by taking sum of scores and dividing by number of scores in file
print("The sum is:", total) #prints the sum of scores
print("The average is:", "{:.2f}".format(average)) #prints the average
filename = input("Enter name of the file: ") #prompts user to enter name of file
scores(filename) #calls scores method by passing the file name to it in order to compute sum and average of file contents i.e. scores
Explanation:
It is assumed that the scores in the file are separated by a blank space.
The scores() method takes a file name as parameter. Then it opens that input file in read mode using object infile.
split() method is used to split the scores in a file into a list. Suppose the scores are 1 2 3 4 5 6 . So after the split, they become ['1', '2', '3', '4', '5', '6']
The loop iterates through each score in the file, splits them into a list and stores this list in lines. The next print statement prints these scores in a list.
The second loop for line in lines iterates through each score of the list and the statements: total= sum(int(score) for score in line) and average =total/len(line) computes the total and average of scores.
total= sum(int(score) for score in line) statement works as follows:
for loop iterates through each element of list i.e. each score
int() converts that string element into integer.
sum() method adds the integers to compute their total.
So if we have ['1', '2', '3', '4', '5', '6'] each element i.e. 1,2,3,4,5,6 is converted to integer by int() and then added together by sum method. So this becomes 1+2+3+4+5+6 = 21. This result is stored in total. Hence
total = 21.
average = total/len(line) works as follows:
The computed sum of scores stored in total is divided by the number of scores. The number of scores is computed by using len() method which returns the length of the line list. So len() returns 6. Hence
average = total/len(line)
= 21 / 6
average = 3.5
The next two print statement prints the value of sum and average and "{:.2f}".format(average)) prints the value of average up to 2 decimal places.
The screenshot of the program along with its output is attached.
Individually or in a group find as many different examples as you can of physical controls and displays.a. List themb. Try to group them, or classify them.c. Discuss whether you believe the control or display is suitable for its purpose.
Answer:
Open ended investigation
Explanation:
The above is an example of an open ended investigation. In understanding what an open ended investigation is, we first of all need to understand what open endedness means. Open endedness means whether one solution or answer is possible. In other words it means that there may be various ways and alternatives to solve or answer a question or bring solution to an investigation.
From the definition, we can deduce that an open ended investigation is a practical investigation that requires students to utilize procedural and substantive skills in arriving at conclusion through evidence gathered from open ended research or experiment(as in not close ended, not limited to ready made options, freedom to explore all possibilities). This is seen in the example question where students are asked to explore the different examples of physical controls and displays and also discuss their observations. Here students are not required to produce a predefined answer but are free to proffer their own solutions
some properties of Internal and External Storage.
Answer:
Internal Storage
This has to do with the primary memory of a computer that is used to store the user's files, applications, etc. This is where the Operating System and pre-installed software is installed. There are two types of internal memory which are ROM and RAM.
Properties
They are volatileThey contain the OS of the systemROM loses data when power is lostRAM does not lose storage when power is lost.External Storage
These are secondary memory that is not primarily permanently attached to the computer. This is a device that contains all the addressable data storage which are not inside the computer's storage. Some examples of external storage are flash drives, CD ROMs, etc.
Properties
They are addressableThey can be easily detached.Why operating system is pivotal in teaching and learning
Answer:
Without it information flow is impossible
Explanation:
The word 'pivotal' also means crucial or vital, and so we need to consider what an operating system actually does.
Remember, merely having all the hardware of a computer would not allow you to run (install and use) programs. It is by means of an operating system that teaching programs can be installed, and it is also by means of an operating system learning can take place.
For example, a student can decode (learn) instructions/lessons from his teacher via a software program; and the software program needs an operating system to open (run) the program.
Which of the following is true about sorting functions?
A. The most optimal partitioning policy for quicksort on an array we know nothing about would be selecting a random element in the array.
B. The fastest possible comparison sort has a worst case no better than O(n log n)
C. Heapsort is usually best when you need a stable sort.
D. Sorting an already sorted array of size n with quicksort takes O(n log n) time.
E. When sorting elements that are expensive to copy, it is generally best to use merge sort.
F. None of the above statements is true.
Answer: Option D -- Sorting an already sorted array of size n with quicksort takes O(n log n) time.
Explanation:
Sorting an already sorted array of size n with quicksort takes O(n log n) time is true about sorting functions while other options are wrong.
Consider the following instruction: OR( %1111_0000, AL ) ; After its execution, what will be true about the bits stored in AL?
Answer:
the higher order bits in AL will be true
Explanation:
We know from the truth table that in an OR operation, once one operand is true the result is true, no matter the value of the other operand. From the above AL will have the higher order bits to be true since the first four higher order bits are 1s, 1111_0000, this is regardless of the original values of AL. We cannot however ascertain if the lower bits of AL are true from this. Note 1 evaluates to true while 0 is false
Assign decoded_tweet with user_tweet, replacing any occurrence of 'TTYL' with 'talk to you later'.Sample output with input: 'Gotta go. I will TTYL.'Gotta go. I will talk to you later.code given:user_tweet = input()decoded_tweet = ''' Your solution goes here '''print(decoded_tweet)
Answer:
Here is the Python program:
user_tweet = input()
decoded_tweet = user_tweet.replace('TTYL', 'talk to you later')
print(decoded_tweet)
Explanation:
The program works as follows:
Suppose the input is: 'Gotta go. I will TTYL'
This is stored in user_tweet. So
user_tweet = 'Gotta go. I will TTYL'
The statement: user_tweet.replace('TTYL', 'talk to you later') uses replace() method which is used to replace a specified string i.e. TTYL with another specified string i.e. talk to you later in the string stored in user_tweet.
The first argument of this method replace() is the string or phrase that is to be replaced and the second argument is the string or phrase that is to replace that specified string in first argument.
So this new string is assigned to decoded_tweet, after replacing 'TTYL' with 'talk to you later' in user_tweet.
So the print statement print(decoded_tweet) displays that new string.
Hence the output is:
Gotta go. I will talk to you later.
Select the function completion that satisfies this docstring description: def convert_to_string(nums): """ (list of number) -> NoneType Replace each item in nums with its string equivalent. >>> nums
Answer:
def convert_to_string(nums):
for i in range(len(nums)):
nums[i] = str(nums[i])
nums = [7, 28, 92]
print(nums)
convert_to_string(nums)
print(nums)
Explanation:
Create a function called convert_to_string that takes one parameter, nums
Create a for loop that iterates through the nums. Inside the loop, set each item to its string equivalent using type casting (str)
Initialize a list
Print the list before the function call
Call the function, passing the list as a parameter
Then, print the list again to see the difference
Write a Bash script that searches all .c files in the current directory (and its subdirectories, recursively) for occurrences of the word "foobar". Your search should be case-sensitive (that applies both to filenames and the word "foobar"). Note that an occurrence of "foobar" only counts as a word if it is either at the beginning of the line or preceded by a non-word-constituent character, or, similarly, if it is either at the end of the line or followed by a non-word- constituent character. Word-constituent characters are letters, digits and underscores.
Answer:
grep -R '^foobar'.c > variable && grep -R 'foobar$'.c >> variable
echo $variable | ls -n .
Explanation:
Bash scripting is a language used in unix and linux operating systems to interact and automate processes and manage files and packages in the system. It is an open source scripting language that has locations for several commands like echo, ls, man etc, and globbing characters.
The above statement stores and appends data of a search pattern to an already existing local variable and list them numerically as standard out 'STDOUT'.
Consider the binary search tree constructed for the words oenology, phrenology, campanology, ornithology, ichthyology, limnology, alchemy, and astrology using alphabetical order. Find the number of comparisons needed to locate or to add each of the following words in the search tree, starting fresh each time:
a. palmistry
b. etymology
c. paleontology
d. glaciology
Explanation:
Binary Search Tree is also called ordered tree or sorted binary tree. In the tree each node contains smaller values in the left side of the subtree and larger values in the right side of the subtree.
Write a function called "equals" that accepts 2 arguments The two arguments will be of type list The function should return one string, either "Equals" or "Not Equals" For the lists to be equal, they need to: Have the same number of elements Have all the elements be of the same type Have the order fo the elements be the same DO NOT USE "
Answer:
import numpy as np
def equals(list1, list2 ):
compare = np.all( list1, list2)
if ( compare == True):
print ( "Equals")
else :
print(" Not Equals")
Explanation:
This python function utilizes the numpy package to compare two list items passed as its argument. It prints out "equals" for a true result and "not equal" for a false result.
Complete the function by filling in the missing parts. The color_translator function receives the name of a color, then prints its hexadecimal value. Currently, it only supports the three additive primary colors (red, green, blue), so it returns "unknown" for all other colors. m 1 - def color_translator(color): 2. if _== "red": 3 hex_color = "#ff0000" 4- elif == "green": 5 hex_color = "#00ff00" elif == "blue": hex_color = "#0000ff" in 0 hex_color = "unknown" return _ . 12 13 14 15 16 17 print(color_translator("blue")) # Should be #0000ff print(color_translator ("yellow")) # should be unknown print(color_translator("red")) # Should be #ff0000 print(color_translator ("black")) # should be unknown print(color_translator("green")) # Should be #00ff00 print(color translator("")) # should be unknown Run Reset
Answer:
The completed program is
def color_translator(color):
if color == "red":
hex_color = "#ff0000"
elif color == "green":
hex_color = "#00ff00"
elif color == "blue":
hex_color = "#0000ff"
else:
hex_color = "unknown"
return hex_color
Explanation:
Since the parameter in the above function is color,
This variable will serve as the name of a color and it'll be used in the conditional statements to check if the name of color is any of red, green and blue;
And that is why we have
if color == "red":
elif color == "green":
elif color == "blue":
The variable used to hold the color codes, hex_color, will be returned at the end of the function and that's why we have
return hex_color
When the program is tested with print(color_translator("blue")) and others, it prints the desired output
Let PALINDROME_DFA= | M is a DFA, and for all s ∈ L(M), s is a palindrome}. Show that PALINDROME_DFA ∈ P by providing an algorithm for it that runs in polynomial time.
Answer:
Which sentence best matches the context of the word reticent as it is used in the following example?
We could talk about anything for hours. However, the moment I brought up dating, he was extremely reticent about his personal life.
Explanation:
Which sentence best matches the context of the word reticent as it is used in the following example?
We could talk about anything for hours. However, the moment I brought up dating, he was extremely reticent about his personal life.
10.7 LAB: Fat-burning heart rate Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burning_heart_rate() to
Answer:
I've written in python
Explanation:
age = int(input("Enter the person's age: ")
def fat_burning_heart_rate(x):
rate =( 70/100 * 220 ) - age
print(fat_burning_heart_rate(age))
Advantages of e commerce
Answer:
A Larger Market
Customer Insights Through Tracking And Analytics
Fast Response To Consumer Trends And Market Demand
Lower Cost
More Opportunities To "Sell"
Personalized Messaging
Hope this helps!
the part of the computer that contains the brain , or central processing unit , is also known the what ?
Answer:
system unit
Explanation:
A system unit is the part of a computer that contains the brain or central processing unit. The primary device such as central processing unit as contained in the system unit perform operations hence produces result for complex calculations.
The system unit also house other main components of a computer system like hard drive , CPU, motherboard and RAM. The major work that a computer is required to do or performed is carried out by the system unit. Other peripheral devices are the keyboard, monitor and mouse.
In using cloud infrastructures, the client necessarily cedes control to the CP on a number of issues that may affect security
a. True
b. False
Answer:
A. True
Explanation:
The correct option is A. True.
Actually, in using cloud infrastructures, the client necessarily cedes control to the CP on a number of issues which may affect security. It may have to restrict port scans and even penetration testing. Moreover, the service level agreements may not actually guarantee commitment to offer such services on the part of the CP. This may result in leaving a gap in security defenses.
Also, when the control of the CP changes, it's evident that the terms and conditions of their services may also change which may affect security.
Does the cloud solution offer equal or greater data security capabilities than those pro-vided by your organization’s data center?
Answer:I think greater. Answer my question that I posted plz
Explanation:
Giving BRANLIEST IFF CORRECT What is the label called for each column in a database? Field File Record Title
Answer:
Title
Explanation:
the others describe other items in a database
Answer:
Title
Explanation: idek but I got it correct on a quiz
Management wants to ensure any sensitive data on company-provided cell phones is isolated in a single location that can be remotely wiped if the phone is lost. Which of the following technologies BEST meets this need?a. Geofencingb. containerizationc. device encryptiond. Sandboxing
Answer:
B. Containerization.
Explanation:
In this scenario, management wants to ensure any sensitive data on company-provided cell phones is isolated in a single location that can be remotely wiped if the phone is lost. The technology which best meets this need is containerization.
In Computer science, containerization can be defined as a process through which software applications are used or operated in an isolated space (environment). It uses an operating system level virtualization method, such as a single host OS kernel, UFS, namespaces, Cgroups, to run software applications.
Hence, using the containerization technology makes it easy to wipe off the cell phones if lost because it is isolated in a single location.
A ………….. is a basic memory element in digital circuits and can be used to store 1 bit of information.
Answer:
A memory cellExplanation: Research has proven that ;
The memory cell is also known as the fundamental building block of computer memory.
It stores one bit of binary information and it must be set to store a logic 1 (high voltage level) and reset to store a logic 0 (low voltage level).
The policy that allows a transaction to commit even if it has modified some blocks that have not yet been written back to disk is called the __________ policy.
Answer:
No-force policy
Explanation:
The policy that allows a transaction to commit even if it has modified some blocks that have not yet been written back to disk is called the _NO-FORCE_ policy.
In data theory, the No-Force Policy is beneficial for the control of transaction. In this policy, when a transaction commits, changes that are made are not required to be written to disk in place. The changes recorded are preserved in order to make transaction durable. The recorded changes must be preserved at commit time.
Which wireless device connects multiple laptops, tablets, phones, and other mobile devices in a corporate environment?
Answer:
Bluetooth or a wifi router or a gateway
Explanation:
#Write a function called population_density. The function #should take one parameter, which will be a list of #dictionaries. Each dictionary in the list will have three #key-value pairs: # # - name: the name of the country # - population: the population of that country # - area: the area of that country (in km^2) # #Your function should return the population density of all #the countries put together. You can calculate this by #summing all the populations, summing all the areas, and #dividing the total population by the total area. # #Note that the input to this function will look quite long; #don't let that scare you. That's just because dictionaries #take a lot of text to define. #Add your function here!
Answer:
def population_density(dictionary_list):
""" this function calculates the population density of a list of countries"""
total_population= 0
total_area= 0
for country in dictionary_list:
total_population += country['population']
total_area += country['area']
population_density = total_population / total_area
return population_density
Explanation:
In python, functions are defined by the "def" keyword and a dictionary is used to hold immutable data key and its value. The for loop is used to loop through the list of dictionaries and the values of the country data and extracted with bracket notation.
Create a class named CarRental that contains fields that hold a renter's name, zip code, size of the car rented, daily rental fee, length of rental in days, and total rental fee. The class contains a constructor that requires all the rental data except the daily rate and total fee, which are calculated bades on the sice of the car; economy at $29.99 per day, midsize at 38.99$ per day, or full size at 43.50 per day. The class also includes a display() method that displays all the rental data. Create a subclass named LuxuryCarRental. This class sets the rental fee at $79.99 per day and prompts the user to respond to the option of including a chauffer at $200 more per day. Override the parent class display() method to include chauffer fee information. Write an application named UseCarRental that prompts the user for the data needed for a rental and creates an object of the correct type. Display the total rental fee. Save the files as CarRental.java, LuxaryCarRental.java, and UseCarRental.java.
Here is my code:
package CarRental;
public class CarRental
{
String name;
int zipcode;
String size;
double dFee;
int days;
double total;
public String getName()
{
return name;
}
public int getZipcode()
{
return zipcode;
}
public String getSize()
{
return size;
}
public int getDays()
{
return days;
}
public CarRental(String size)
{
if(size.charAt(0)=='m')
dFee = 38.99;
else
if(size.charAt(0)=='f')
dFee = 43.50;
else
dFee = 29.99;
}
public void calculateTotal(int days)
{
total = dFee*days;
}
public void print()
{
System.out.println("Your rental total cost is: $" + total);
}
}
package CarRental;
import java.util.*;
public class LuxaryCarRental extends CarRental
{
public LuxaryCarRental(String size, int days)
{
super(size);
}
public void CalculateTotalN()
{
super.calculateTotal(days);
dFee = 79.99;
int chauffer;
Scanner keyboard = new Scanner(System.in);
System.out.println("Do you want to add a chauffer for $200? Enter 0 for"
+ " yes and 1 for no");
chauffer = keyboard.nextInt();
if(chauffer!=1)
total = dFee;
else
total = dFee + 100;
}
}
package CarRental;
import java.util.*;
public class UseCarRental
{
public static void main(String args[])
{
String name, size;
int zipcode, days;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter total days you plan on renting: ");
days = keyboard.nextInt();
System.out.println("Enter your name: ");
name = keyboard.next();
System.out.println("Enter your billing zipcode: ");
zipcode = keyboard.nextInt();
System.out.println("Enter the size of the car: ");
size = keyboard.next();
CarRental economy = new CarRental(size);
economy.calculateTotal(days);
economy.print();
LuxaryCarRental fullsize = new LuxaryCarRental(size, days);
fullsize.CalculateTotalN();
fullsize.print();
}
Answer:
Here is the corrected code: The screenshot of the program along with its output is attached. The comments are written with each line of the program for better understanding of the code.
CarRental.java
public class CarRental { //class name
//below are the data members name, zipcode, size, dFee, days and total
String name;
int zipcode;
String size;
double dFee;
int days;
double total;
public String getName() { //accessor method to get the name
return name; }
public int getZipcode() { //accessor method to get the zipcode
return zipcode; }
public String getSize() { //accessor method to get the size
return size; }
public int getDays() { //accessor method to get the days
return days; }
public CarRental(String size) { //constructor of CarRental class
if(size.charAt(0)=='e') // checks if the first element (at 0th index) of size data member is e
dFee = 29.99; // sets the dFee to 29.99
else if(size.charAt(0)=='m') // checks if the first element (at 0th index) of size data member is m
dFee = 38.99; // sets the dFee to 38.99
else // checks if the first element (at 0th index) of size data member is f
dFee =43.50; // sets the dFee to 43.50
}
public void calculateTotal(int days) { //method calculateTotal of CarRental
total = dFee*days; } //computes the rental fee
public void print() { //method to display the total rental fee
System.out.println("Your rental total cost is: $" + total); } }
Explanation:
LuxuryCarRental.java
import java.util.*;
public class LuxuryCarRental extends CarRental { //class LuxuryCarRental that is derived from class CarRental
public LuxuryCarRental(String size, int days) { // constructor of LuxuryCarRental
super(size);} //used when a LuxuryCarRental class and CarRental class has same data members i.e. size
public void calculateTotal() { //overridden method
super.calculateTotal(days); // used because CarRental and LuxuryCarRental class have same named method i.e. calculateTotal
dFee = 79.99; //sets the rental fee at $79.99 per day
total = dFee; } //sets total to rental fee value
public void print(){ //overridden method
int chauffeur; // to decide to include chauffeur
Scanner keyboard = new Scanner(System.in); //used to take input from user
System.out.println("Do you want to add a chauffeur for $200? Enter 0 for"
+ " yes and 1 for no"); // prompts the user to respond to the option of including a chauffeur at $200 more per day
chauffeur = keyboard.nextInt(); //reads the input option of chauffeur from user
if(chauffeur==1) //if user enters 1 which means user does not want to add a chauffeur
total = dFee; //then set the value of dFee i.e. $79.99 to total
else //if user enters 0 which means user wants to add a chauffeur
total = dFee + 200; //adds 200 to dFee value and assign the resultant value to total variable
System.out.println("Your rental total cost is: $" + total); } } //display the total rental fee
UseCarRental.java
import java.util.*;
public class UseCarRental{ //class name
public static void main(String[] args){ //start of main() function body
String name, size; // declare variables
int zipcode, days; //declare variables
Scanner keyboard = new Scanner(System.in); // to take input from user
System.out.println("Enter total days you plan on renting: "); //prompts user to enter total days of rent
days = keyboard.nextInt(); // reads value of days from user
System.out.println("Enter your name: "); //prompts user to enter name
name = keyboard.next(); //reads input name from user
System.out.println("Enter your billing zipcode: "); // prompts user to enter zipcode
zipcode = keyboard.nextInt(); //reads input zipcode from user
System.out.println("Enter the size of the car: "); // prompts user to enter the value of size
size = keyboard.next(); //reads input size from user
CarRental economy = new CarRental(size); //creates an object i.e. economy of class CarRental
economy.calculateTotal(days); //calls calculateTotal method of CarRental using instance economy
economy.print(); //calls print() method of CarRental using instance economy
LuxuryCarRental fullsize = new LuxuryCarRental(size, days); //creates an object i.e. fullsize of class LuxuryCarRental
fullsize.calculateTotal(); //calls calculateTotal method of LuxuryCarRental using instance fullsize
fullsize.print(); }} //calls print() method of LuxuryCarRental using instance fullsize
In the three As of security, which part pertains to describing what the user account does or doesn't have access to
Answer:
Authorization
Explanation:
Which function in Excel tells how
? many numeric entries are there
SUM O
COUNT
SQRT O
SORT O
Answer:
Count
Explanation:
Let's see which function does what:
SUM
This function totals one or more numbers in a range of cells.COUNT
This function gets the number of entries in a number field that is in a range or array of numbersSQRT
This function returns the square root of a number.SORT
This function sorts the contents of a range or array.As we see, Count is the function that gets the number of entries.
Answer:
CountExplanation:
Tells how many numeric entries are there.
Write a method that accepts a String object as an argument and returns a copy of the string with the first character of each sentence capitalized. For instance, if the argument is "hello. my name is Joe. what is your name?" the method should return the string "Hello. My name is Joe. What is your name?" Demonstrate the method in a program that asks the user to input a string and then passes it to the method. The modified string should be displayed on the screen.
Answer:
The programming language is not stated; However, the program written in C++ is as follows: (See Attachment)
#include<iostream>
using namespace std;
string capt(string result)
{
result[0] = toupper(result[0]);
for(int i =0;i<result.length();i++){
if(result[i]=='.' || result[i]=='?' ||result[i]=='!') {
if(result[i+1]==' ') {
result[i+2] = toupper(result[i+2]);
}
if(result[i+2]==' ') {
result[i+3] = toupper(result[i+3]);
}
} }
return result;
}
int main(){
string sentence;
getline(cin,sentence);
cout<<capt(sentence);
return 0;
}
Explanation:
The method to capitalize first letters of string starts here
string capt(string result){
This line capitalizes the first letter of the sentence
result[0] = toupper(result[0]);
This iteration iterates through each letter of the input sentence
for(int i =0;i<result.length();i++){
This checks if the current character is a period (.), a question mark (?) or an exclamation mark (!)
if(result[i]=='.' || result[i]=='?' ||result[i]=='!') {
if(result[i+1]==' '){ ->This condition checks if the sentence is single spaced
result[i+2] = toupper(result[i+2]);
-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized
}
if(result[i+2]==' '){ ->This condition checks if the sentence is double spaced
result[i+3] = toupper(result[i+3]);
-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized
}
}
} The iteration ends here
return result; ->The new string is returned here.
}
The main method starts here
int main(){
This declares a string variable named sentence
string sentence;
This gets the user input
getline(cin,sentence);
This passes the input string to the method defined above
cout<<capt(sentence);
return 0;
}