string arrays in a for loop?

Forgive me if my terminology is off. I'm using visual studio 2008 c++. I'm doing a movie rental project where I have to create a list of movies (listing name, price, and quantity), and then be able to display/modify them. I've done for loops with arrays of integers, but not strings. I'm only posting a portion as it is quite lengthy. This is what I have done so far, but to no avail :/


I've tried tried some things in the for loops, but I've just gotten some unexplainable errors which even my classmates could not solve.
but I just cannot do this yet.

for the function displayMovieList, I tried:

for (char element=model.item;element<size;element++)
but it didn't work

All suggestions are welcome. Thanks!
Last edited on
Um. You have a LOT of really weird stuff in there...

First:
cin>>(cin,item.movie); I'm not sure what you are trying to do here. >_>
You are lucky this even works!

Second:
std::string's are not char arrays, and they are not implicitly convertable. If you want to pass an std::string to a function, pass a string, and take a string, don't try to take a char[].

You also have a BUNCH of errors with stuff like line 38/49, char[stuff] doesn't make sense at all...

I would suggest re-reading your text on the more basic programming stuff (functions, variables), and then see if you can find more of the errors you have.
Last edited on
char is a keyword. You can't name a variable 'char'. The blue syntax highlighting is sort of a clue to that:

void displaymovieList(dvdMovie char[],int size)

That will error, as will pretty much everywhere else you're using the word 'char'.

Change char to something else and that should clear up most/all of your errors.
Last edited on
I've tried tried some things in the for loops, but I've just gotten some unexplainable errors which even my classmates could not solve.
but I just cannot do this yet.

Please post your algorithm hir step by step from step 1 upto last step, i dont need code, i will code it for you to make your homework done.
us3rn4m3 wrote:
i will code it for you to make your homework done.


wat?
Topic archived. No new replies allowed.