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
What's the best way to use a lectern during your speech?
valentina_108 [34]

<span>Make eye contact look at everyone ur speaking to not just one person speak loud and clearly make sure your understandable</span>
6 0
4 years ago
Read 2 more answers
The weight of your car will also affect its_____.
Usimov [2.4K]

Answer: C

Explanation:

4 0
3 years ago
Read 2 more answers
ANSWER QUICKLY!!
ehidna [41]

Answer: The answer is Proximity.

Explanation:

4 0
2 years ago
A spreadsheet has some values entered: Cell A1 contains 10, cell A2 contains 14, cell A3 contains 7. You enter in cell A4 the fo
Alinara [238K]
A1 is 10, so your answer is 10+2=12
B. 12
6 0
3 years ago
Read 2 more answers
How are authentication and authorization alike and how are they different? what is the relationship, if any, between the two\?
Helen [10]
  Both authentication and authorization are terms used in information security and <span>intelligently controlling access to </span>computer<span> resources. </span><span>Authentication is the process where by an individual’s (user's) identity is confirmed, whereas authorization is the association of that identity with rights/</span>privileges and permissions to resources related to information security.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Complete method printPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "Too
    5·1 answer
  • File-sharing programs such as Napster, Kazaa, and iMesh make it possible for individuals to exchange music files over the Intern
    7·1 answer
  • Define an organizational unit in your own words.
    11·1 answer
  • Three homework questions I can't figure out, please help?
    11·1 answer
  • I am doing 7th grade coding 3.02 assignment can anybody help me it says bad input on line 3 and this is what it is can someone h
    6·1 answer
  • Write a function SwapArrayEnds() that swaps the first and last elements of the function's array parameter.
    6·1 answer
  • Who is the best basketball player ever... if you do not say lebron do not comment
    5·1 answer
  • चार फरक छुट्याउनुहोस् ।) 3. Write down any four provisions of cyber ethic साइबर नैतिकताका कुनै चार प्रावधानहरु लेख्नुहोस् ।​
    11·1 answer
  • A sample member of the list data is a1 = ['male', True] where the second item is True if the person is on the phone.
    15·2 answers
  • Match the term with the appropriate definitions : Edge Computer Applications ANSWERED
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!