Re: Structure required on left side of . or .*

@martinmax3 -- The code you have is just wrong as there is nothing you can really do with that like c.erase(0,4);. Comment it out and try to work though the code to figure out what it was doing there.

The dot operator here is trying to call a "member function" called "erase", the problem is that c is a char array and char arrays do not have member functions, it must be a class or struct etc. to have a member function.

As for the compiler. Your so called "college" is ripping you off if it is using a book that uses TurboC/Borland 3.1 -- that was my very first compiler and I do have much love for it, but it is 20 years old and pre-dates modern C++ by quite a bit.

It is horrible that your school is still using something that old because technology moves pretty fast. Imagine taking an an English class that used Elizabethan English to teach. Sure there are wonderful reasons to do this, it will ensure you have a better understanding of Shakespeare! But it also means that you will not understand, and have a difficult time speaking to users of the modern language.

It is pretty much the same thing with this... except maybe instead of Elizabethan english we are referring to 80's slang.

When you graduate you are going to have to unlearn all the crap they taught you in school and re-learn modern programming.

the thing is. Most modern compilers are free. And it is actually kind of hard to find a book that covers that old C/C++ -- so your school is actively ripping you off. They are conspiring with some book publisher / software vendor to charge you to learn 20 year old techniques. They are literally crooks and you are letting them get away with it.

Your compiler will not even run on modern 64bit computers!!! Your school is wasting your time and money!

But the thing is: you are the customer.

Do yourself a favor: Get a new compiler (they are free). Start to learn modern programming rather than anachronistic Turbo-C from the 1980's. It will not cost you anything but a little time and effort.

Re: Structure required on left side of . or .*

Posted 11 July 2011 - 05:27 AM

Oh and if you are in India I am sorry. The corruption there seems to run pretty deep on this issue. The author of the book and publishers are apparently on the board that decides what books get used in state-run facilities? Anyway I don't know the detail but from a outside perspective it is pretty crazy how many people are paying for and getting a crappy education because of that.

Re: Structure required on left side of . or .*

Posted 11 July 2011 - 05:42 AM

So I got MS Visual C++ 2010 Express and still this string type does not work. I am probably messing up something.

I am not from India, I am from Bulgaria. I am not exactly sure about this book I saw the code in, it might be old and that's why the code is outdated. But the program I use for C++ (Borland C++ 3.1) was what I studied in my school for C++, I downloaded my copy from the website of the biggest Technical University in my country, which is in our capital.

So I will just hope I get lucky and qualify, because if I don't I might have to go to a even worse college. People from this "worse" college came to our school and probably went to a lot of other schools, and let us cheat and talk to each other. And also to be even more sure we will get good marks before the test starts they saed that the grading system is such that there is no way for someone to get less than 4 (probably it's C your mark system). So it's like if you hold this exam you qualify for sure. They must be in desperate need for students.

Re: Structure required on left side of . or .*

Posted 11 July 2011 - 05:45 AM

Sounds highly corrupt.
I would recommend to continue studying at your current college, but also in your own time to download a good free compiler (like Visual C++ 2010 or Code::Blocks), and learn modern C++ via online tutorials.

The reason string doesn't go bold is because it's not a built in data type -- it's a class, a custom data type, kind of like cout.

so that part is ok... but look at the loop. rd is 6 ints long... n is the number of values in the array hora. So if the user enters 100 records in hora... then that little loop will zoom past the end of rd...

Re: Structure required on left side of . or .*

Posted 11 July 2011 - 11:52 AM

Thanks so much, Nick! It does what it is supposed to now and runs, but it gives out strange numbers at the end. The good thing is I now know how to do this, it won't be the same task, but it will be like it.