And for the alignment:
cout << setf(ios::right, ios::adjustfield) << setw(n);
Should do it.
Type: Posts; User: mousey
And for the alignment:
cout << setf(ios::right, ios::adjustfield) << setw(n);
Should do it.
Thanks for the quick reply - just one more:
strcat(line, from[pos]); gives the error 'Could not find a match for strcat(char, const char)'.
I included <cstring>.
I'm writing a small function to retrieve the first line from a C style string passed (I have my own reasons). Here's the code so far, in essence:
char* getaline(char const* const from, char* to) {
...
Well, for the triangle one, I would use recursion (a function calling itself). Create a traingle() function, probably one that takes the height as an argument, and calculate and output the number of...
I like to think of the postfix version as a sort of sidenote. eg...
y = x++;
...would be "Y equals x. Oh, and increment x.", whereas
y = ++x;
...would be "Y equals x incremented".
I'm going by a fairly old book here (I'm not particulary bothered, it's a great book), so that might be my problem, but does istream::getline() still exist? My compiler gives me an error when I tell...
Thanks, that's really useful :)
Lol, I guess you could say I'm a newbie C++ programmer, but I'm experienced in Pascal and Basic (to an extent), and I've programmed in C before, so I know the basics :).
So I could actually...
I suppose I was trying to mix to many different styles there. Thanks for the help.
(by the way, I was returning char& so I could say something like cout << foo(a,b);)
Does it really matter if...
I don't suppose there's a way of doing that by using references in the argument list?
Hi, little problem with references, char*s and passing.
To simplify the problem:
#include <iostream.h>
char& foo(char& c, const char& d) {
cout << c << " " << d << endl;
c = d;
...