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 command do we use to enter data from the keyboard?
SVEN [57.7K]
D I would think……… good luck
6 0
2 years ago
To give your app users the ability to open your app directly from other apps by clicking a link, you should use:.
pickupchik [31]
<span>To give your app users the ability to open your app directly from other apps by clicking a link, you should use:  deep link. With the deep link and its URL functionality, existing app users are driven directly inside the mobile app itself. 
</span>Deep links are usually made up of two parts: a scheme (part of the link that identifies which app to open).<span>and a </span>host and path (<span>the unique location in the app where your content exists).</span>

7 0
2 years ago
if i set my payment and use free trial on Scribd website, can i cancel my payment and NOT PAYING after one month??
svlad2 [7]
Yes you can, although, this question should have been directed towards the Scribd support team.
6 0
3 years ago
I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
mihalych1998 [28]

Answer:

Use font colors that work well with your background.

Select font sizes that are appropriate for your delivery method.

Fonts should be appropriate for your audience.

Limit the number of fonts you use to three or four.

Hope this helps!

3 0
3 years ago
Darpa was created to
I am Lyosha [343]
Darpa is an agency that emerges technologies for the military. I would say B. investigate technologies. This is logical because they are working with technologies investigating how, where, and why they need to emerge in the first place.
7 0
3 years ago
Other questions:
  • Show the contents of a queue after the following operations are performed. Assume the queue is initially empty. enqueue(45); enq
    6·1 answer
  • What is wrong, logically, with the following code? if (x &gt; 10) System.out.println("Large"); else if (x &gt; 6 &amp;&amp; x &l
    11·1 answer
  • Write an application named [LastName]_MultiplicationTable and create a method that prompts the user for an integer value, for ex
    11·1 answer
  • The lightbulb transfers electricity energy into light what is one type of energy that is also generated that is not a desired af
    14·1 answer
  • Blank determines the overall brightness or darkness of an entire image
    5·1 answer
  • What is a characteristic of tasks in Outlook?
    10·2 answers
  • Acciones de un lápiz
    7·1 answer
  • Reading (BCK FORM 2C IT 2020-2021)
    12·2 answers
  • true Or False 1. Computer Time is located in Start Menu, b. Ms Word is developed by Adobe Corporation c. Ms-Excel is Presentatio
    9·1 answer
  • What was the name of the first computer, developed by charles babbage?.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!