1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lyudmila [28]
4 years ago
13

Write a code segment that takes an emailaddress stored in the string email and stores theuser name in the string user and the ho

staddress in the string host. Remember that the user name and host address are separated by thecharacter @.
Computers and Technology
1 answer:
iragen [17]4 years ago
8 0

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

  string email,username,host;//strings to store email,username,hostname..

  cout<<"Enter the email address "<<endl;

  cin>>email;//taking input of email address..

  bool flag=1;

  for(int i=0;i<email.length();i++)//iterating over the string email..

  {

      if(email[i]=='@')//if @ symbol is encountered make flag 0 skip this iteration.

      {

          flag=0;

          continue;

      }

      if(flag==1)//add to username if flag is 1.

      {

          username+=email[i];

      }

      else//add tom host..

      host+=email[i];

  }

  cout<<"The username is "<<username<<endl<<"The host name is "<<host;//printing the username and hostname..

return 0;

}

Explanation:

I have taken  three strings to store the email address entered by user ,username and host to store username and host name respectively.Then I am iterating over the string email if @ is encountered then skip that iteration before that keep adding characters to username string and after that keep adding characters to host.

You might be interested in
True or false :Beyond fulfilling legal obligations, a diverse workplace offers many other benefits as well.
KengaRu [80]
The answer to your question is true.
7 0
3 years ago
Can Sombody please help me with this question, I'm struggling!
hjlf

Answer:

umm let me check if my answer is right

Explanation:

3 0
4 years ago
Explain how you would define a variable named balance, assuming that it will only be accessed in a single function.
olganol [36]

The ways to define a variable named balance, if only it can be accessed in a single function are:

First the variable name need to begin  with a letter or an underscore character (_).

Note that the variable name is one that cannot begin with a digit.

Then make sure that the  variable name can only have alpha-numeric characters and underscores ( a-z, A-Z , 0-9 , and _ )

Note also that  Variable names are the ones that are said to be case-sensitive (age, Age and AGE are said to be different variables)

<h3>How do you define a variable name?</h3>

The Rules for naming a variable is that  A variable name is one that need to have only have letters (that is uppercase and lowercase letters), digits and also an underscore. T

Note that the first letter of a variable can be letter or an underscore.

Learn more about variable name from

brainly.com/question/13162404

#SPJ1

8 0
2 years ago
Find the maker(s) of the PC(s) with the fastest processor among all the PCs that have the smallest amount of RAM.
aleksley [76]

Answer:

the makers of PC is Charles's babbage.analog is has small amount of ram

3 0
2 years ago
In which stage of investigation does a digital forensics expert perform self-assessment?
VMariaS [17]
I think the answer might be b
8 0
3 years ago
Read 2 more answers
Other questions:
  • Your computer is crashing on a regular basis. Which of the following is an operation available to the user that should help rese
    6·2 answers
  • Explain the term remote backup with examples.​
    5·1 answer
  • SQL a. has become the de facto standard database language b. can be used to define database systems c. both a. and b. d. none of
    10·1 answer
  • Dakota's friend Stephen created a cypher using the QWERTY keyboard, but Dakota is confused. Stephen said to move one to the righ
    5·1 answer
  • ) The order of messages on a sequence diagram goes from _____. (Points : 6)
    8·1 answer
  • Assume that another method has been defined that will compute and return the student's class rank (Freshman, Sophomore, etc). It
    8·1 answer
  • If any one has mincraft on ps4 bedrock we can finish building a BIG city world all we need to put is a shop and money dispensers
    8·2 answers
  • What is algorithm and how does it works​
    11·2 answers
  • Write a for loop that uses the loop control variable to take on the values 0 through 10.
    10·1 answer
  • Should a UDP packet header contain both Sour Port # and Destination Port #?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!