I started this code and there's some errors here's what i had to code. I had to write a program that stores a string containing a full name (First Middle Last) with a single space between any two successive names then it outputs each part of the name in a separate line. For testing purpose, your program MUST use the following name “Henry Louis Aaron” where the output in this case will as given below. Make sure that your program should function properly in case you use any other full name (it should be generic).
First Name: Henry
Middle Name: Louis
Last Name: Aaron
is what the output should look like.
I'm not really sure what your asking. What do you mean about the name "Henry Louis Aaron"? Is that just a test name to see if the program works, but the user actually ought to be able to enter anything they want? And what exactly is the output supposed to be? That three line information table? Or is that the console with input on it?
actually i dont think that's the error theres a shit load of errors, could you copy my code into your visual basic as a C++ source file, and run it without debugging and tell me whats wrong with it?
You had the code there already; it displayed the names separated by spaces. Just change it to display "First:" "Middle:" and "Last:" in front of the respective variable.
That's probably not helping your understanding. If you don't understand how to edit the code you have here, you probably need to write it again from scratch. It might seem like overkill, but it will help you figure out how much you know how to do. That's going to be important if you ever have to do this in the future.
*Sigh* I see no reason to just give you answers so that you can pass a class. If you don't know enough to do this assignment, I don't understand why you think you deserve a good grade on it. You ought to get a grade based on whether or not you can do the work; clearly, you can't do the work. Thus, you will get a less desirable grade. If you have a question about how to do something specific, by all means, ask and we can assist you but we won't simply "do it" or "finish it."
Don't take this personally. It's how I feel, and pretty well aligned with the policies of this forum.
#include <iostream>
#include <string>
// you need to tell the compiler where the entry point is int main()
//{
string first;
string middle; // here you have your variables declared
string last;
cout<<"Enter your first name: ";
cin.getline(first); // this works and you can also get inpout like cin>>first;
cout<<"Enter your middle name: ";
cin.getline(middle);
cout<<"Enter your last name: ";
cin.getline(last);
string first="Henry"; //here you have the same variable declared twice
string middle="Louis"; // either get rid of all strings and make it middle = "Louis"
string last="Aaron"; //or declare different variables like first1, or something else
string name;
name = first + " " + middle + " " + last;
cout << "Name is: " << name << endl;
// dont forget return 0;
//} //everything else should compile, but I'm not debugging it for you
#include <iostream>
#include <string>
int main()
{
string first1;
string middle1;
string last1;
cout<<"Enter your first name: ";
cin>>first; // this works and you can also get inpout like cin>>first;
cout<<"Enter your middle name: ";
cin>>middle;
cout<<"Enter your last name: ";
cin>>last;
string first= "Henry"; //here you have the same variable declared twice
string middle = "Louis"; // either get rid of all strings and make it middle = "Louis"
string last = "Aaron"; //or declare different variables like first1, or something else
string name;
name = first + " " + middle + " " + last;
cout << "Name is: " << name << endl;
return 0;
}