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
Need answer ASAP
Mnenie [13.5K]

Answer:

c is the correct awnser ( to code and test )

6 0
3 years ago
Read 2 more answers
100 POINTS + BRAINLYEST TO FIRST PERSON THAT IS CORRECT!!! Which items can be found in the Properties section of the Backstage V
Lunna [17]

Print settings

author off document

how many times it has been viewed

4 0
2 years ago
Read 2 more answers
For an alternative to the String class, and so that you can change a String's contents, you can use_________ .
mr_godi [17]

Answer:

c. StringBuilder

Explanation:

An alternative to the String class would be the StringBuilder Class. This class uses Strings as objects and allows you to mix and match different strings as well as adding, removing, implementing,  and modifying strings themselves as though they were similar to an array. Unlike the string class StringBuilder allows you to modify and work with a combination of strings in the same piece of data as opposed to having various objects and copying pieces which would take up more memory.

7 0
3 years ago
The _____ constraint assigns a value to an attribute when a new row is added to a table
bixtya [17]

The default constraint gives a value to an attribute when a new row is added to a table.

<h3>Is default a kind of constraint?</h3>

This is known to be a type of constraint that often apply a value to a column if an INSERT statement does not really give the value for the column.

Therefore, one can say that the default constraint gives a value to an attribute when a new row is added to a table.

Learn more about default constraint from

brainly.com/question/19130806

#SPJ12

5 0
2 years ago
When a security administrator wants to conduct regular test on the strength of user passwords, what may be the best setup for th
wariber [46]
I think it’s letter c
4 0
2 years ago
Other questions:
  • Annabella was giving a presentation to a group of 20 real estate agents on
    15·2 answers
  • There are many differenttypes of models, but an individual DSS can consist of onlyone.
    15·1 answer
  • What do you think about net neutrality??
    6·2 answers
  • I don't know the answer and I tried different ones and they not what the book is looking for.
    7·1 answer
  • From the Software Engineering Code of Ethics, which clauses relate to intellectual property (check all that apply)
    15·1 answer
  • Although some families have more resources than other families, there is always a limited amount of resources that families have
    15·2 answers
  • Need help with this​
    5·1 answer
  • HELP!!! Bad things about Helen Keller. I'm doing a debate and i need to prove that Steve Jobs is better than Helen Keller!!
    14·1 answer
  • Algorithm to eat orange<br><br>​
    10·2 answers
  • . Why is it important to use Social Media responsibly? ANSWER NOW!!!
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!