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, 22.06.2019 14:40
You begin your first day of responsibilities by examining the recent is security breach at gearup to get ideas for safeguards you will take. at gearup, criminals accessed the company's improperly-secured wireless system and stole customers' credit card information as well as employee social security numbers. what kind of computer crime did gearup face?
Answers: 3
question
Computers and Technology, 23.06.2019 10:00
How do i delete my account on this because i didn't read this agreements and also i put age at xd
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 2
question
Computers and Technology, 24.06.2019 11:20
Print "censored" if userinput contains the word "darn", else print userinput. end with newline. ex: if userinput is "that darn cat.", then output is: censoredex: if userinput is "dang, that was scary! ", then output is: dang, that was scary! note: if the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "program end never reached." the system doesn't print the test case that caused the reported message.#include #include using namespace std; int main() {string userinput; getline(cin, userinput); int ispresent = userinput.find("darn"); if (ispresent > 0){cout < < "censored" < < endl; /* your solution goes here */return 0; }
Answers: 3
You know the right answer?
Write an expression to detect that the first character of the userinput matches the firstletter.
Questions