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]
3 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]3 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
Which of the following is based on the visibility and location of an object’s features?
grandymaker [24]

Answer:

The answer is Lines.

Explanation:

A visible line, or object line is a thick continuous line, used to outline the visible edges or contours of an object. A hidden line, also known as a hidden object line is a medium weight line, made of short dashes about 1/8” long with 1/16”gaps, to show edges, surfaces and corners which cannot be seen.

7 0
3 years ago
Which type of link is normally used to interconnect two peripheral modules (pm) in the digital multiplex system (dms)?
natta225 [31]

The answer is DS-30A. The Roland DS30A is a 24-bit Digital Reference Monitor which can add pristine 24-bit/96kHz. They are small speakers.

4 0
3 years ago
Samuel was hired to create a program that asks the user questions and, based on the answers, recommend a book to read. What kind
quester [9]

Answer:

I think the answer is C

Explanation:

Selection

3 0
3 years ago
A friend of yours started her own dog walking business. At first she only had a couple customers, and she used Word to create al
GaryK [48]
Hire more people to help type her documents, or make Batch invoices
4 0
3 years ago
Which of these words does not describe factual data
kipiarov [429]
The correct answer is "opinion".

<span>Opinions are almost never factual which is why they are opinions. </span>
5 0
3 years ago
Read 2 more answers
Other questions:
  • When you are printing handouts, which of these can you do? A. Save paper by placing more than one slide per page. B. Check the f
    7·1 answer
  • PLEASE HELP ME!!!!
    12·2 answers
  • The term generally used to describe storage systems that function at high speeds is:
    12·1 answer
  • A company that manufactures machine parts orders a new system that makes products at ten times the speed of the earlier machine.
    15·1 answer
  • The interprets the data while it is in RAM​
    8·1 answer
  • Define Based Assessment ​
    5·1 answer
  • PACIFIC NORTHWEST
    10·1 answer
  • Which of the following best describes contextual design?
    10·1 answer
  • Budgeting for a Computer
    6·1 answer
  • You are planning to depart on a flight from area 2 to area 4 in 12 hours. What weather is forecast to occur along your route?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!