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 is the next line?
lianna [129]

Answer:

4

Explanation:got it right on edg.

4 0
2 years ago
how to create use an array of Course objects instead of individual objects like course 1, course 2, etc
AURORKA [14]

Answer:

To save the course object instances in an array, use;

Course[] courses = new Course[7];

courses[0] = new Course("IT 145");

courses[1] = new Course("IT 200");

courses[2] = new Course("IT 201");

courses[3] = new Course("IT 270");

courses[4] = new Course("IT 315");

courses[5] = new Course("IT 328");

courses[6] = new Course("IT 330");

Explanation:

The java statement above assigns an array of size 7 with the course class constructor, then order courses are assigned to the respective indexes of the new array.

3 0
3 years ago
In modern computer systems, a byte consists of
Cerrena [4.2K]
8 smaller units, called bits :)
8 0
3 years ago
Create the following matrix M: 1 7 13 19 25 ?-3 9 15 21 27 5 11 17 2329By writing one command and using the colon to address ran
zimovet [89]

Answer:

Matlab code is:

>> M=reshape(1:2:29, 3,5)

>> \%  (a)

>> Va=M(3,:)

>> \% (b)

>> Vb=M(:,4)

>> \% (c)

>> Vc=[M(2,:) M(:,3)']

Explanation:

>>\% \ Making\ the\ Matrix\ With\ required\ terms\ 1\ to\ 29\ with\ spaces\ of\ 5\ in\ three\ rows

>> M=reshape(1:2:29, 3,5)

M =

              1   7  13  19  25

              3  9  15  21  27

              5  11  17  23  29

>> \%  (a)

>>\%\ Slicing\ M\ \ from\ third\ row\ till\ end

>> Va=M(3,:)

Va =\\\ 5\ 11\ 17\ 23\ 29

>> \% (b)

>>\% \ Slicing\ the\4th\ column\ of\  M\ matrix\

>> Vb=M(:,4)

Vb =\\ 19\\ 21\\ 23\\

>> \% (c)

>>\% \ slicing\ the\ 2nd\ row\ and\ 3rd\ column\ of\ M\ Matrix\ and\ combining\ them\ to\ make\ a\ row\ matrix

>> Vc=[M(2,:) M(:,3)']

Vc =\\ 3\ 9\ 15\ 21\ 27\ 13\ 15\ 17

>>

The code is tested and is correct. If you put a semi colon ' ; ' at the end of every statement then your answer will be calculated but matlab doesn't show it until you ask i.e. typing the variable (Va, Vb, Vc )and press enter.

6 0
3 years ago
What are web services?
nekit [7.7K]

So far the most general and convincing definition is to say that Web Services are the set of applications or technologies with the ability to interoperate on the Web. These technologies exchange data between them in order to offer services.


7 0
3 years ago
Other questions:
  • What new deal programs were created to build dams to control flooding and generate electric power?
    13·1 answer
  • Assume arr2 is declared as a two-dimensional array of integers. Which of the following segments of code successfully calculates
    6·1 answer
  • Credibility means that the reader perceives value in what you write.<br> True False
    12·1 answer
  • Which key is used in word processors to create indentations?
    13·2 answers
  • There was a thunderstorm in your area and the power is out. The traffic lights are not functioning. Explain what you should do w
    8·2 answers
  • 5. ADD A STATEMENT OR STATEMENTS to the program on the following page (including constant and/or variable declarations if you wa
    6·1 answer
  • Similarites between hardware and software
    9·1 answer
  • Can i edit my name on this app?
    7·1 answer
  • 2) A simple operating system supports only a single directory but allows it to have arbitrarily many files with arbitrarily long
    7·1 answer
  • Use the drop-down menus to complete the statements about changing mail options in Outlook.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!