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 statements is not true? Question 16 options: a) SQL is the most popular query language used for interacti
lisov135 [29]

Answer:

The answer to this question is option "d".

Explanation:

In this question option d (A user fills out a form to construct a description of the data desired in a SQL search) is not true. Because SQL stands for Structured Query Language. This is a query language used to communicate with a database and a user fills the form. Which is not possible in the SQL. So the option d is not true.

4 0
3 years ago
Fire stick optimizing system storage and applications
vivado [14]

Answer:

IN MY PROFILE

Explanation:

I HAVE AWNSERED THIS QUESTION THROUGHOUT MY BEING HERE PLEASE DO NOT BE AFRAID TO CLICK ON MY PROFILE AND FIND THE ANSWER

5 0
3 years ago
According to Newton's Second Law of Motion, when an object is acted on by an unbalanced force, how will that object respond?
Murrr4er [49]
A. It will decrease speed
5 0
3 years ago
You need to upgrade memory in a system but you don't have the motherboard documentation available. you open the case and notice
Harlamova29_29 [7]
<span>The three yellow slots probably indicate triple channeling, which means the board uses DDR3 DIMMs. To know for sure, remove a DIMM and look for the position of the notch on the DIMM.</span>
6 0
3 years ago
Alex is nearing graduation. His counselor showed him this information. Alex's College Costs &amp; Payment Options per Year Costs
Pie

Answer:

A

Explanation:

In my opinion, it is best he works the extra $1300 which wouldn't require him to abandon his college plans, wait an extra year or get himself into the trouble of loans.

Cheers

6 0
3 years ago
Read 2 more answers
Other questions:
  • What is Software? Write the functions of Software?​
    11·1 answer
  • How many bit does four gigabyte has
    8·2 answers
  • Pleaseeee help me w this!
    10·1 answer
  • What is not true of credit scores?
    11·1 answer
  • Advancements in nuclear science have led to technological advances which are both harmful and beneficial. Which would be conside
    15·1 answer
  • ___________________ are aggregated collections of memory and cpu resources that can be shared among groups of virtual machines o
    11·1 answer
  • Users at UC need to be able to quickly create a Resource record from the Project record's Chatter feed How should the App Builde
    10·1 answer
  • Outline four types of cyber law.
    14·1 answer
  • If a filesystem has a block size of 4096 bytes, this means that a file comprised of only one byte will still use 4096 bytes of s
    12·1 answer
  • __________ is a broad class of software that is surreptitiously installed on a user's machine to intercept the interaction betwe
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!