To make your code neater you can hit enter(just not in the middle of your strings), like:
cout<<"According to my calculations...if you were to buy..."
<<userinput[0]<<" cars for $"
<<userinput[1];
as the compiler will get rid of the whitespace.
The nice thing about cout is that you can simply keep giving it input without an "endl" or a "\n" and it will keep it on the same line.
cout<<"According...";
cout<<userinput[0];
cout<<" yada yada"
cout<<endl;
and it will be all on one line too. Experiment with it a little.
As far as your second problem, you probably have a second cpp file in your project calledwhatevermyprojnameis.cpp, which contains a main() by default. Go ahead and either omit that file from your project, or delete the code that's put in there by default.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581
There can only be one main per project, as the compiler has to know where the entry point is. It can be in the same source file as your other code, or by itself.
jonsca
Quantitative Phrenologist
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581