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
AnnyKZ [126]
3 years ago
10

A String variable, fullName, contains a name in one of two formats:last name, first name (comma followed by a blank), orfirst na

me last name (single blank)Extract the first name into the String variable firstName and the last name into the String variable lastName. Assume the variables have been declared and fullName already initialized. You may also declare any other necessary variables.
Computers and Technology
1 answer:
Volgvan3 years ago
8 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   char fullname[30];

   string fname="",lname="";

   int i,j;

   cout<<"Enter fullname\n";

   cin.getline(fullname,30); //so that blank can be read

   for(i=0;fullname[i]!=' ';i++)

       fname+=fullname[i];   //fistname will be saved

      cout<<"\n";

   for(j=i;fullname[j]!='\0';j++)

       lname+=fullname[j];    //lastname will be saved

   cout<<"\nFirstname : "<<fname<<"\nLastname : "<<lname;

   return 0;

}

OUTPUT :

Enter fullname

John thomson

Firstname : John

Lastname : thomson

Explanation:

cin.getline() should be used instead of cin in case of strings so that space can be read otherwise after blank string will be ignored.

You might be interested in
What should we do to prevent software piracy?
frozen [14]

Answer:

1. Read the End User License Agreement (EULA) for each software product you purchase.

2. Purchase CD software only from reputable resellers.

3. Purchase software downloads directly from the manufacturer's website.

4. Register your software to prevent others from attempting to install your software on their computers.

5. Report piracy if you discover that software you purchased is not authentic or if you suspect that an online reseller or retail establishment is selling counterfeit software.

Link: https://www.techwalla.com/articles/how-to-stop-software-piracy

-Please mark as brainliest!- Thanks!

7 0
3 years ago
How did the computer obtain its current ip address? how can you determine this
salantis [7]
Ip Adress is a one of a kind series of numbers isolated by periods that distinguishes every PC utilizing the Internet Protocol to convey over a system. These are the default setting when the PC can't discover a system and on the grounds that it is the Server's nearby IP.
4 0
4 years ago
Match the actions of individuals with the code of conduct they are adhering to. Sofia is an HR Manager who keeps all employee re
aksik [14]

All the code of conducts is good and it is expected from each and every employee of the organization. Employee details needs to be kept confidential and Sofia, the HR manager is adhering to it. Employee’s productivity increases if unnecessary use of mobile phone stops.

It is always recommended to use free items than the copyrighted items. It’s a good ethical practice. Becky is also right, because he considers work as work and does not get deviated with dinner invites and gifts.

5 0
3 years ago
Read 2 more answers
The code below is repetitious. What is the output of this program?
expeople1 [14]

Answer:

6

Explanation:

5 0
3 years ago
Read 2 more answers
What two protocols are used for remote access to a server, using unencrypted and encrypted transmissions respectively? answer
drek231 [11]
Telnet or rsh and ssh, http and https, ftp and sftp or ftps ? How are you accessing the server?
8 0
3 years ago
Other questions:
  • In Python please:
    15·1 answer
  • Input numbers and segregate them by placing their values into even or odd vectors based upon their value being even or odd. Then
    12·1 answer
  • WILL THUMBS UP!!!!!ALL COMMENTS!!!!!!
    11·1 answer
  • Write an if-else statement with multiple branches. If givenYear is 2101 or greater, print "Distant future" (without quotes). Els
    15·2 answers
  • Now write a program named GreenvilleRevenue that prompts a user for the number of contestants entered in last year’s competition
    6·1 answer
  • 1. How do you know that A Drop of Water is an expository<br> text? GENRE
    7·1 answer
  • Intrusion Detection System (IDS) is a security mechanism that detects unauthorized user activities, attacks, and network comprom
    5·1 answer
  • Withdrawal from a conflict is best used when ______.
    6·2 answers
  • Can someone tell me how to hit on a link on Brainly to see the answer
    10·2 answers
  • How many combinations of 1s and Os can we make with 6 place values?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!