subject

Write an expression to detect that the first character of the userinput matches the firstletter.
sample program:
#include
#include
using namespace std;
int main() {
string userinput;
char firstletter = '-';
userinput = "banana";
firstletter = 'b';
if () {
cout < < "found match: " < < firstletter < < endl;
}
else {
cout < < "no match: " < < firstletter < < endl;
}
return 0;
}
print "censored" if user text contains the word "darn", else print userinput. end with new line.
sample program:
#include
#include
using namespace std;
int main() {
string userinput;
userinput = "that darn cat.";
return 0;
}
set haddigit to true if the 3-character passcode contains a digit.
sample program:
#include
#include
#include
using namespace std;
int main() {
bool hasdigit = false;
string passcode;
int valid = 0;
passcode = "abc";
if (hasdigit) {
cout < < "has a digit." < < endl;
}
else {
cout < < "has no digit." < < endl;
}
return 0;
}
replace any space ' ' by '_' in 2-character string passcode.
sample program:
#include
#include
#include
using namespace std;
int main() {
string passcode;
passcode = "1 ";
cout < < passcode < < endl;
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
What operating system is a smartphone most likely to use? 1.bsd 2.mac os x 3.symbian 4.linux
Answers: 1
question
Computers and Technology, 22.06.2019 17:40
Consider the simple 3-station assembly line illustrated below, where the 2 machines at station 1 are parallel, i.e., the product only needs to go through one of the 2 machines before proceeding to station 2.what is the throughput time of this process?
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Stops: using the information learned in this course, explain three things you will not do when driving. a. b. c. explain why you will not do these things when driving. starts: using the information learned in this course, explain three things you will do when driving. a. b. c. explain why you will do these particular things when driving. explain one thing you will stop doing as a passenger. explain one thing you will start doing as a passenger.
Answers: 3
question
Computers and Technology, 23.06.2019 17:30
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2Δƒβ€”, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5Δƒβ€” slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
You know the right answer?
Write an expression to detect that the first character of the userinput matches the firstletter.
Questions
Questions on the website: 13722359