//flex table opened by JP

Click to See Complete Forum and Search --> : Is this how you would do it?


nothing
01-21-2004, 03:12 PM
#include <iostream>
using std::cout;
using std::endl;

#include <string>
using std::string;

int main()
{
string name = ("nothing 11.50");
string salary;

salary = name.substr(30, EOF);

cout << salary << endl;

return 0;
}


A name and the salary corresponding to that name will be stored on the same line in my database. There will always be thirty blank characters between the name and the salary, counting from the first letter of the name to the first number of the salary. Is this how you would do it to get the salary for a determined name? Thanks :t

Dark_Raver
01-21-2004, 10:25 PM
i don't think that will work. EOF is for end of file, you are working with a string.

you can always calculate how long is the string you want by substracting 30 from the length of the string name.
use that as your second parameter in the substr function call.