Besides the support these cards express, identity provide through the power of language.
What do you mean by power of language?
The power of language is comprised of two main components: the power to talk and be understood, and the ability to listen and comprehend. Individuals with high language skills can communicate effectively in social situations. When non-native speakers participate in oral communication, native speakers of that language identify sufficiently well-formed speech, in the sense that it is sufficiently 'native' or close to what they know as 'their language' to be totally understood. Non-native speakers must be capable of comprehending and digesting words delivered at real-world rates of speech in the manner spoken by native speakers of that language when listening to a secondary language.
The card drives that send thousands of cards to US troops deployed around the world also establish identity through the power of language.
To learn more about power of language
https://brainly.com/question/28275319
#SPJ4
Answer: comfort
Explanation:
Driving is expensive. Write a program (in Python) with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('{:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3))
x=float(input("How many miles can your vehicle travel on 1 gallon of gasoline?: "))
y=float(input("How much does 1 gallon of gasoline cost?: "))
print('20 miles: {:.2f}$\n75 miles: {:.2f}$\n500 miles: {:.2f}$'.format((20/x)*y, (75/x)*y, (500/x)*y))
if you have two folders open on your desktop and you want to move a file from one folder to the other, simply ___ the file.
if you have two folders open on your desktop and you want to move a file from one folder to the other, simply Drag and Drop the file.
What are the different ways to move or copy a file or folder?By dragging and dropping with the mouse, using the copy and paste commands, or by utilizing keyboard shortcuts, a file or folder can be transferred or relocated to a new location.
Note that in Drag & drop, Just like you would with a file on your desktop, you can move a file or folder from one folder to another by dragging it from its present location and dropping it into the destination folder.
Learn more about copying files from
https://brainly.com/question/17019048
#SPJ1
Write an HLA Assembly language program that prompts for two specific int8 values named start and stop and then displays a repeated digit pattern starting with that number. The repeated digit pattern should show all the numbers beginning with the start value and then adding 1, 2, 3, 4, ... to this value until you hit a number greater than the stop value. Shown below is a sample program dialogue.
Using the knowledge of computational language in python it is possible to write a code that prompts for two specific int8 values named start and stop and then displays a repeated digit pattern starting with that number.
Writting the code:start:
mov al, start
add al, '0'
mov ah, 0eh
int 10h
stop:
mov al, stop
add al, '0'
mov ah, 0eh
int 10h
prompt:
mov dx, offset start
mov ah, 09h
int 21h
mov dx, offset stop
mov ah, 09h
int 21h
mov dx, offset pattern
mov ah, 09h
int 21h
;display start
mov al, start
add al, '0'
mov ah, 0eh
int 10h
;display stop
mov al, stop
add al, '0'
mov ah, 0eh
int 10h
;display pattern
mov dx, offset pattern
mov ah, 09h
int 21h
;get input
mov ah, 01h
int 21h
cmp al, start
je start
cmp al, stop
je stop
cmp al, 0ffh
je done
jmp prompt
done:
mov ah, 4ch
int 21h
start db 'start: ', 0
stop db 'stop: ', 0
prompt db 'prompt: ', 0
pattern db 'Here's your answer: ', 0
end start
See more about HLA Assembly language at brainly.com/question/13034479
#SPJ1
Write an outdoor temperature monitoring application that allows a user to keep entering daily high temperature readings (in Fahrenheit) until the user enters 888.
If the temperature entered is less than -20 or more than 120, display an appropriate message and do not use the temperature.
An outdoor temperature monitoring application is given below:
package pack10;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter daily high temperature readings (in Fahrenheit) ");
int input;
int numDays=0;
int highTemp=-999;
int lowTemp=999;
double average=0;
while(true) {
System.out.print("Enter temperature : ");
input = sc.nextInt();
if(input==555) {
break;
}
if(input<-20 || input>120) {
System.out.println("Error!!! Please enter temperatur in range -20 to 120 exclusive");
}else {
numDays++;
if(input>highTemp) {
highTemp = input;
}
if(input<lowTemp) {
lowTemp = input;
}
average += input;
}
}
System.out.println("Number of days the temperature entered : "+numDays);
System.out.println("The minimum temperature is : "+lowTemp);
System.out.println("The maximum temperature is : "+highTemp);
average/=numDays;
System.out.println("The average of the temperature is : "+average);
}
}
What is a program?A computer program is a set of instructions written in a programming language that a computer can execute. Software includes computer programs as well as documentation and other intangible components. Source code refers to a computer program in its human-readable form.
The outdoor temperature monitoring application that allows a user to keep entering daily high temperature readings is illustrated above.
Read more about programming here:
https://brainly.com/question/23275071
#SPJ1`
Asha wants to fill out an online form and pay her college tuition fee using the public Wi-Fi at a coffee shop. She uses her friend’s laptop to do this. How can she make her transaction safer?
Asha should use a to perform the transaction with .
Since Asha uses her friend’s laptop to do this. How can she make her transaction safer, Asha should use a secure browser to perform the transaction and also with the use of a one-time password
What is a secure browser?A secure browser is one that has additional security features to assist stop unauthorized third-party activities while you browse the web. These browsers feature a "white list," or a list of permitted programs and activities, and they forbid the start-up of any functionalities that are not included in that list.
Note that Secure browsers view the webpages while closely monitoring user behavior. It will restrict access to potentially harmful websites and pop-up advertisements. It is an excellent filter to stay safe even though the user has the series to override the said parameters and still visit these sites.
Learn more about secure browser from
https://brainly.com/question/10450768
#SPJ1
Jordan is a 3D modeler using three circle made from edges—one large, one medium, and one small circle—and lines them up in front of one another from largest to smallest. Then Jordan fills the space between the edges of the circles with faces, making a telescope-looking cylinder. What type of modeling is Jordan using?
Question 7 options:
Digital Sculpting
Polygonal Edge Modeling
NURBS Modeling
Procedural Modeling
Since Jordan is a 3D modeler using three circle made from edges—one large, one medium, and one small circle—and lines them up in front of one another from largest to smallest. The type of modeling is Jordan using is option B: Polygonal Edge Modeling.
What is a polygon 3D modeling?
Polygonal modeling is a technique used in 3D computer graphics to represent or approximate an object's surface using polygon meshes. For real-time computer graphics, polygonal modeling is the preferred technique since it is ideally suited to scanline rendering.
A 3D model's fundamental geometric elements are polygons. The polygon's vertices and edges are all straight. The created plane is known as a face and is typically a "triangular polygon," a geometric object with three sides. There are additionally "quads" and "n-gones" with four sides and several vertices.
Note that We build a polygon around each hole to identify an area of influence for that hole using the polygon method, an established and time-tested technique based on a straightforward geometric algorithm.
Learn more about Edge Modeling from
https://brainly.com/question/2141160
#SPJ1
Ali receives an email from a person posing as a bank agent, who asks Ali to share his bank account credentials. Which type of network attack does this scenario indicate?
The network attack in this scenario is . This attack can occur .
Phishing is the type of network attack which this scenario indicates. This type of attack can take place via electronic messages.
What is network attack?
Network attacks are illegal activities on digital assets within an organization's network. Malicious parties typically use network assaults to change, destroy, or steal private data. Network attackers typically target network perimeters in order to obtain access to interior systems. In a network attack, attackers aim to breach the business network perimeter and obtain access to internal systems. Once inside, attackers frequently combine different forms of assaults, such as compromising an endpoint, propagating malware, or exploiting a weakness in a system within the network.
To learn more about network attack
https://brainly.com/question/14980437
#SPJ13
Conditionals often run on {} instructions.
A
if / else
B
if / then
C
unless / until
D
up to / at least
Answer: A
Explanation: This is a if/else Statement
In any programming language, the code has to make decisions and carry out actions depending on different inputs.
Functions of a DVD in computer
DVD is a digital optical disc storage format that are commonly used to store large amounts of data, such as high-quality videos and movies. A DVD-ROM drive and DVD player software are required to read and play DVDs on a computer.
What exactly is a DVD?
DVD (digital video disc) is an optical data storage technology similar to compact disc (CD). Optical data storage is a technique that stores digital information (1's and 0's) by reading the information with light.
A DVD movie is depicted in the image of the Matrix DVD movie disc. It is also where the operating system is kept. In 1995, four companies named Philips, Sony, Toshiba, and Panasonic invented and developed it. The first DVD-ROM drives that used these discs were sold in 1997.
To learn more about DVD
https://brainly.com/question/26223221
#SPJ9
Read an integer value representing a year. Determines if the year is a leap year. Prompts the user to enter another year or quit.
A year is a leap year if −
1. It is evenly divisible by 100
2. If it is divisible by 100, then it should also be divisible by 400
3. Except this, all other years evenly divisible by 4 are leap years.
sample run:
Enter a year (0 to quit): 2024
2024 is a leap year
Enter a year (0 to quit): 1997
1997 is not a leap year
Enter a year (0 to quit):
The code to verify if an year is a leap year is developed throughout this answer.
Code to verify if the year is a leap yearWe are going to develop a C code, hence first we declare the main function, as follows:
int main(){
return 0;
}
Then, we declare the integer variable to store the year, as follows:
int main(){
int year;
return 0;
}
Then the year is read in a loop, until the year read is different of 0.
int main(){
int year;
do{
printf("Enter a year (0 to quit):\n");
scanf("%d", & year);
}while(year != 0);
return 0;
}
Then conditional clauses are inserted to verify if the year number is an acceptable input (non-negative number), and if it is a leap year.
do{
printf("Enter a year (0 to quit):\n");
scanf("%d", & year);
if(year > 0){
//Calculates the remainder of the division by 4.
if(year % 4 == 0){
//If divisible by 4 but not by 100, it is a leap year.
if(year % 100 != 0){
printf("%d is a leap year\n", year);
}
//If divisible by 100, it is only a leap year if divisible by 400 also
else{
if(year%400 == 0){
printf("%d is a leap year\n", year);
}
else{
printf("%d is not a leap year\n", year);
}
}
}
//If not divisible by 4, then it is a not leap year
else{
printf("%d is not a leap year\n", year);
}
}
}while(year != 0);
return 0;
}
Learn more about leap years at https://brainly.com/question/24224214
#SPJ1
1.Create a new password
1-Develop an algorithm using pseudocode and a flowchart that asks the user to
create a new password.
The algorithm should:
• get the user to enter a password
● get the user to re-enter the password
• repeat the two bullet points above until both entered passwords are
identical
output "password created" when they are identical
The algorithm of the question will be:
1. Start
2. get the user to enter a password
3. get the user to re-enter the password
4. if the passwords are not identical, repeat steps 1 and 2
5. output "password created" when the passwords are identical.
6. End
Algorithm:
An algorithm in computer science is a finite sequence of strict instructions that is often used to solve a class of specialised problems or to execute a computation. Algorithms serve as specifications for calculating and processing data. Advanced algorithms can execute automated deductions and apply mathematical and logical tests to direct code execution through several paths.
To learn more about algorithm
https://brainly.com/question/24953880
#SPJ13
6.How can an Infocion raise a complaint of sexual harassment?
a.By writing to GRB
b.Inform/consult your manager and report to the company.
c.By sending an email to your HR Business PArtner
d.Any of the above
Answer:
d. any of the above
Explanation:
remember to give me a Brainest
like ,star,comment.
PLEASE HELP
Find five secure websites. For each site, include the following:
the name of the site
a link to the site
a screenshot of the security icon for each specific site
a description of how you knew the site was secure
Use your own words and complete sentences when explaining how you knew the site was secure.
The name of the secure websites are given as follows:
Each of the above websites had the security icon on the top left corner of the address bar just before the above domain names.
What is Website Security?The protection of personal and corporate public-facing websites from cyberattacks is referred to as website security.
It also refers to any program or activity done to avoid website exploitation in any way or to ensure that website data is not accessible to cybercriminals.
Businesses that do not have a proactive security policy risk virus spread, as well as attacks on other websites, networks, and IT infrastructures.
Web-based threats, also known as online threats, are a type of cybersecurity risk that can create an unwanted occurrence or action over the internet. End-user weaknesses, web service programmers, or web services themselves enable online threats.
Learn more about website security:
https://brainly.com/question/28269688
#SPJ1
1_>circle 2_>retangle 3->triangle 4_>square 5_>trapezoid 6_>parallelogram enter the figure code 2 enter the breadth and length
# define a function for calculating
# the area of a shapes
def calculate_area(name):
# converting all characters
# into lower cases
name = name.lower()
# check for the conditions
if name == "rectangle":
l = int(input("Enter rectangle's length: "))
b = int(input("Enter rectangle's breadth: "))
# calculate area of rectangle
rec area = l * b
print(f"The area of rectangle is: rec area")
elif name == "square":
s = int(input("Enter square's side length: "))
#calculate area of square
sqt_area = s * s
print(f"The area of square is
{sqt_area}.")
elif name == "triangle":
h = int(input("Enter triangle's height length: "))
b = int(input("Enter triangle's breadth length: "))
# calculate area of triangle
tri_area = 0.5 * b * h
print(f"The area of triangle is
{tri_area}.")
elif name == "circle":
r = int(input("Enter circle's radius length: "))
pi = 3.14
# calculate area of circle
circ_area = pi * r * r
print(f"The area of circle is
{circ_area}.")
elif name == 'parallelogram':
b = int(input("Enter parallelogram's base length: "))
h = int(input("Enter parallelogram's height length: "))
# calculate area of parallelogram
para_area = b * h
print(f"The area of parallelogram is
{para_area}.")
else:
print("Sorry! This shape is not available")
# driver code
if __name__ == "__main__" :
print("Calculate Shape Area")
shape_name = input("Enter the name of shape whose area you want to find: ")
# function calling
calculate_area(shape_name)
Output:
Calculate Shape Area
Enter the name of shape whose area you want to find: rectangle
Enter rectangle's length: 20
Enter rectangle's breadth: 15
The area of rectangle is 300.
What is code?
In computing, source code, is any collection of code, with or without comments, written in a human-readable programming language. The source code of a programme is specially designed to aid the work of computer programmers, who write source code to specify the actions to be performed by a computer.
To learn more about code
https://brainly.com/question/26134656
#SPJ9
if you're connected to a switch and your nic is in promiscuous mode, what traffic would you be able to capture? check all that apply.
If one is connected to a switch and the NIC is in promiscuous mode, the traffic that one would be able to capture are:
"packets transmitted to your switch port, which means traffic to or from your computer or broadcast packets. This is because one is connected to a switch.
"Promiscuous mode" is a mode of operation as well as a security, monitoring, and management strategy in computer networking. In promiscuous mode, a network device, such as an adapter on a host system, can intercept and read each network packet that comes in its entirety.
Promiscuous mode on a network permits a network device to intercept and read each network packet that comes in its entirety. Promiscuous mode is a mode of operation in an Ethernet local area network (LAN) in which every data packet delivered can be received and read by a network device.
You can use any of the following commands to put an interface into idle mode, the latest way is to use the "ip" command. Use the ifconfig command to determine if the NIC is set to promiscuous mode.
Learn more about Switches:
https://brainly.com/question/1147908
#SPJ1
Chris is unfamiliar with the word processing program he is using. He wants to find
the drop-down text-driven options for the document view because he does not yet
recognize the icons at the top of the window. Where can Chris find these drop down
options?
Answer:
Explanation:
Chris is unfamiliar with the word processing program he is using. He wants to find the drop-down text-driven options for the document view because he does not yet recognize the icons at the top of the window. Where can Chris find these drop down options?
Question 4 options:
Options bar
Scroll bar
Toolbar
Menu bar
Discuss in brief the major of components of computer network?
The major components required to install software are computer network components. NIC, switch, cable, hub, router, and modem are all important network components. Some network components can be removed depending on the type of network that needs to be installed. A wireless network, for example, does not require a cable.
The following are the major components needed to set up a network:
1)NIC: NIC is an abbreviation for network interface card. A network interface card (NIC) is a piece of hardware that connects one computer to another on a network. It has a transfer rate range of 10,100 to 1000 Mb/s.
2)Hub: A hub is a piece of hardware that divides a network connection among multiple devices. When a computer requests information from a network, it first sends the request via cable to the Hub. This request will be broadcast to the entire network by Hub.
3)Switch:A switch is a piece of hardware that connects multiple devices on a computer network. A Switch has more sophisticated features than a Hub.
4)Router: A router is a piece of hardware that connects a local area network (LAN) to the internet. It receives, analyses, and forwards incoming packets to another network. A router operates on the OSI Reference Model's Layer 3. A router routes a packet based on the information in the routing table.
5)Modem: A modem is a piece of hardware that allows a computer to connect to the internet via an existing telephone line. A modem is not built into the motherboard; rather, it is installed in a PCI slot on the motherboard.
6)Cables: A cable is a type of signal transmission medium.
What is computer network?
A computer network is a group of computers that share resources on or provided by network nodes.
To learn more about computer network
https://brainly.com/question/1167985
#SPJ9
HELP!
What is a central processing unit? Select two options.
the electronic circuitry that receives data and transforms it to human-readable form
the electronic circuitry that stores data and instructions so they can be processed
the electronic circuitry that handles all the instructions it receives from hardware
the electronic circuitry that stores information for immediate use by software
the electronic circuitry that handles all the instructions it receives from software
It is right to state that a central processing unit (CPU) is;
the electronic circuitry that handles all the instructions it receives from hardware; (Option C)the electronic circuitry that handles all the instructions it receives from software. (Option E)What is a CPU?A processor's four fundamental functions are retrieve, decode, execute, and write back. Fetch- is the operation that gets instructions from a system's RAM from program memory.
A CPU, or central processing unit, is the computer's brain. The CPU, like that of a human brain, regulates all computer processes. The CPU's role is to monitor input data from devices such as mice and other applications. Then it seeks up instructions for that data and executes them.
Learn more about central processing units:
https://brainly.com/question/28548014
#SPJ1
Answer:
C and E
Explanation:
Which of the following statements are true about routers and routing on the Internet.
a. Protocols ensure that a single path between two computers is established before sending packets over it.
b. Routers are hierarchical and the ""root"" router is responsible for communicating to sub-routers the best paths for them to route internet traffic.
c. A packet traveling between two computers on the Internet may be rerouted many times along the way or even lost or ""dropped"".
d. Routers act independently and route packets as they see fit.
A packet traveling between two computers on the Internet may be rerouted many times along the way or even lost or ""dropped"" is the statements are true about routers and routing on the Internet. Hence, option C is correct.
What is routers?A router can connect one or more packet-switched networks or subnetworks. It controls traffic between several networks and enables multiple devices to share an Internet connection by transmitting data packets to their intended IP addresses.
In addition to VPN routers, wired, wireless, core, and edge routers are also included.
In order to transfer data between two or more packet-switched computer networks, a router—either real or virtual—is used. A router looks at the destination's Internet Protocol address and chooses the best route for the data packet to take in order to get there.
Thus, option C is correct.
For more information about routers, click here:
https://brainly.com/question/15851772
#SPJ12
answer the following questions in 1 minute
actuator
connector
sensor
Answer: sensor
Explanation:
What is the work of continue statement in c programming
Answer:
The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop.
Explanation:
wireless network devices use ________ to communicate with each other.
wireless network devices use Radio Waves to communicate with each other.
What is Radio Waves?Radio waves are one type of electromagnetic radiation. A radio wave has a significantly longer wavelength than visible light. People frequently use radio waves for communication. In order to transmit and receive radio frequency energy, this radio tower employs both rectangular and circular antennas.
AM and FM radio broadcasting deliver sound to a large audience. Radar is a detection tool that collects data about objects using radio waves. Bluetooth and wireless communication connect devices by using radio waves.
Radio equipment requires electromagnetic waves to transmit and receive in order to function. The radio signal is an electronic current that moves very quickly.
Thus, it is a Radio Waves.
For more information about Radio Waves, click here:
https://brainly.com/question/21995826
#SPJ12
> sata 6 gb/s transfer rate > 1 tb capacity > minimizes noise to levels near the threshold of human hearing > 3.5-inch 7,200 rpm > 32 mb buffer size 1. which sata version is being used?
SATA III (6 Gbs/600 MBs) version of sata is being used.
What is SATA?
Serial ATA (SATA) is a computer bus interface that connects host bus adapters to mass storage devices such as hard disc drives, optical drives, and solid-state drives. Serial ATA surpassed the older Parallel ATA (PATA) standard to become the main storage interface.
SATA III, or SATA 6Gb/s, is the most recent generation of SATA. The SATA III interface operates at 6Gb/s, with a bandwidth throughput of 600MB/s. Each SATA version is backwards compatible with previous versions. However, when relying on backwards compatibility, the data transfer rate may be slower than planned due to power constraints and port speed limitations.
To learn more about SATA
https://brainly.com/question/4555139
#SPJ4
2_What is the shape of the potato peleer?Why does it have this shape and dimensions
Answer: call 023 2344 0092
Explanation:
he is my teacher
word feature that allows you to copy all the format settings applied to selected text to the other text that you want to format in a similar way is called
Select the full paragraph, such as the paragraph mark, if you wish to duplicate the text and paragraph formatting. Within the Clipboard group is Format Painter. In the Clipboard group of the Message tab, select Format Painter. Format Painter stands alone.
What is Format Painter?
Use Format Painter to swiftly apply the same formatting to numerous pieces of text or pictures, such as colour, font style and size, and border style. Think of it as pasting and copying for formatting. With format painter, you may copy all of the formatting from one object then apply it to another. Character and paragraph formats can be copied and pasted into text using the Format Painter tool. The Format Painter tool is located on the Home tab of a Microsoft Word Ribbon and can be used in conjunction with styles to organise and reformat documents more quickly and easily. Format Painter can be found in earlier versions of Microsoft Word on the toolbar above the menu bar at the top of the programme window.
To learn more about format painter
https://brainly.com/question/10869688
#SPJ4
you have used firewalls to create a demilitarized zone. you have a web server that needs to be accessible to internet users. the web server must communicate with a database server for retrieving product, customer, and order information. how should you place devices on the network to best protect the servers? (select two.)
Answer:
1. Put the database server on the private network.
2. Put the web server inside the DMZ.
kind regards
Which menu option allows you to change the display to close-up, single, or multiple pages?
Question 3 options:
Insert
Edit
View
File
The menu option that allows you to change the display to close-up, single, or multiple pages is view. The correct option is C.
What is menu option?A menu is a set of options presented to a computer application user to assist them in finding information or performing a function.
Menus are common in graphical user interfaces (GUIs) provided by operating systems such as Windows and MacOS. They're also used in speech recognition and on websites and web pages on the internet.
The View menu, located at the top of the screen, contains the following commands: Sheets: Upon selection, a cascade menu appears, displaying a list of all sheets used in the document, sorted from left to right.
View is the menu option that allows you to switch between close-up, single, and multiple page displays.
Thus, the correct option is C.
For more details regarding menu option, visit:
https://brainly.com/question/3507017
#SPJ1
Test if a number grade is an F (less than or equal to 65). If so, print "That’s not good.". (Python)
Hint: Grades may be decimals.
Sample Run
Enter a Number: 60
Sample Output
That's not good.
Answer:
grade = float(input(Enter a number grade: "))
if grade <= 65:
print("That's not good")
Explanation:
Answer:
grade=float(input("Enter a number grade:"))
if grade<=65:
print("That's not good.")
Explanation:
I got a 100% on the question. The first answer had a few mistakes in it.
Sincerely,
Dangerous Gem
which type of infrastructure service stores and manages corporate data and provides capabilities for analyzing the data?
Services for managing and storing corporate data as well as giving users the tools to analyze it.
VoIP, also known as IP telephony, enables users to place or receive phone calls through a broadband internet connection. In this regard, VoIP serves as the foundational technology for the online transmission of speech and other multimedia material. The services offered by all the software and hardware are the main emphasis of IT infrastructure. IT infrastructure is a group of company-wide services that management budgets for and consists of both technical and human resources. SaaS offers on-demand or recurring delivery of software programs through the internet. The cloud service providers host, control, and manage the software program as well as look after the supporting infrastructure.
Learn more about Services here-
https://brainly.com/question/12096912
#SPJ4
A high school has 1000 students and 1000 lockers, one locker for each student. On the first day of school, the principal plays the following game: She asks the first student to go and open all the lockers. She then asks the second student to go and close all the even-numbered lockers. The third student is asked to check every third locker. If it is open, the student closes it; if it is closed, the student opens it. The fourth student is asked to check every fourth locker. If it is open, the student closes it; if it is closed, the student opens it. The remaining students continue this game. In general, the nth student checks every nth locker. If the locker is open, the student closes it; if it is closed, the student opens it. After all the students have taken their turn, some of the lockers are open and some are closed. Write a C++ program that prompts the user to enter the number of lockers in a school. After the game is over, the program outputs the number of lockers that are opened.
#include <bits/stdc++.h>
static int counter=0;
int check_locker(int num) {
//Pass the first student. All lockers are open.
std::vector<int> lockers(num,1);
//Second student. Close the even locker(s).
for(int i=1;i<=lockers.size();i++) {
if(i%2==0) {
lockers.at(i-1)=0;
} else {
;;
}
}
//Each n. student will check.
for(int j=3; j<=lockers.size();j++) {
for(int m=j; m<=lockers.size();m+=j) {
if(lockers.at(m-1)==1) lockers.at(m-1)=0;
else lockers.at(m-1) = 1;
}
}
//Count 1's
for(auto& c:lockers) {
if(c==1) counter++;
else ;;
}
/*For debug purposes, if you want to print the locker's status, activate!
for(auto& p:lockers) {
std::cout << p << " ";
}
*/
return counter;
}
int main(int argc, char* argv[]) {
//Get the amount of lockers from user.
std::cout << "How many lockers does the school have?: ";
int idx; std::cin>>idx;
//Waiting..
std::cout << "Evaluating..\n";
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
//Send data into check_locker()
std::cout << "There is/are " << check_locker(idx) << " open locker(s)." << std::endl;
return 0;
}