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
Two of the major sources used today for obtaining information to create computer maps are satellites and _____________.
nikdorinn [45]
The Global Positioning System or GPS.
7 0
3 years ago
Read 2 more answers
In which area of engineering does material selection play a vital role a design optimization b forensic engineering c mechanical
const2013 [10]
D. Prototyping. This is because a prototype is basically a replica of the original one and in order to find out what all we need to add in our original, material selection plays a vital role in prototypes.
4 0
3 years ago
Which are the benefits of leveraging web technologies?
allsm [11]

Lower cost - You can leverage web technologies like FB and Google which allow you to advertise and reach billions of users relying on their services at a very low cost as compared to other mediums.  

Security – Data stored with web technology companies offers more security because it is stored in huge data centers that have high-end protection

Increase business efficiency – Web technologies can increase business efficiency and unlock value in your business functions. They can reduce time, provide critical analytics and help your business grow.

4 0
3 years ago
Read 2 more answers
What is the number reason for conflict on a team?
Viefleur [7K]

Answer:

jvphcrx8cctiit9t9t9t

5 0
3 years ago
Whose massively popular photo led to the creation of google images?
Alex
Jennifer Lopez’s picture led to the creation of google images.
5 0
3 years ago
Other questions:
  • Which of the following characters at the beginning of a cell signifies to Excel that it should perform a calculation for the val
    13·1 answer
  • .____________ is a way to identify and differentiate goods andservices through use of a name or distinctive design element.
    10·1 answer
  • EX 3.8 Write code to declare and instantiate an object of the Random class (call the object reference variable rand). Then write
    6·1 answer
  • Which type of computer graphic can be blown up to a much larger size without getting distorted or losing quality?
    5·1 answer
  • What is SoC? how is it different from CPU?
    14·1 answer
  • What is the name of the unique identifier assigned to any personal computer that is connected to the internet?
    11·1 answer
  • Please choose odd one out please tell fast ​
    13·2 answers
  • 1. Who was the first lady programmer?​
    14·2 answers
  • Are there any Potential Dangers in Artificial Intelligence?
    11·2 answers
  • Jobs that use math and science to solve problems involving the design and development of technologies can be found in the what c
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!