couple C++ syntax errors
I'm trying to creat a program in C++ the creats a database for videos!
Using GCC-3.3.1, command = g++ file.cpp -g Problem #1= syntax error before `void' Problem #2 = syntax error before `[' token problems are annotated with 'RED' coments Code:
#include <iostream> |
Why the extra function declaration towards the beginning of main()?
Code:
void Read_Data_File(int&, Videos []) ; |
????? :confused: ?????
What????? are you stating that in the begining of main I should just Code:
void Read_Data_File () ; Code:
void Read_Data_File (int&, Video[]) ; "Video" is another one of my great fat fingering tricks where I forget witch thing I called what. |
/* Readng the Data file */
void Read_Data_File(int&, Video[]) //Problem #1 { ... } In that fuction I think you need something like: void Read_Data_File(int variable, Videos array_Video[]) //Problem #1 and you also need to send the variables when you call the function I don't see you do that: // calls function to read data file void Read_Data_File(num_video, The_Videos) ; hope this is it |
OOOOOOOOOOHHHHHHHHHH
I see thank you very much!!! [edit] have any idea what this mean??? Having trouble finding an answer on google.com error: type specifier omitted for parameter `The_Videos[]' Code:
. |
For that first declaration I mentioned (inside of main), if you are trying to call the function at that point, it should look something like:
Code:
Read_Data_File(num_videos, The_Videos); Code:
void Read_Data_File( int & numberOfVideos, Videos[] The_Videos) In your last question about 'type specifier omitted', you did not declare what data type The_Videos[] is in the argument list. Should be 'Videos The_Videos[]' or some such. |
Ok I guess I don't see like I thought I did!
i'm giving up for tonight :confused: + :scratch: = brain Thanks for trying to help though! |
Problem #1: The structure type is Videos not Video. Also, you need to give names to your arguments.
Problem #2: The structure type is Videos not Video. Problem #3: You have an extra "do {" without a closing "} while()". I recommend that you work on improving your coding style:
Here's your code refactored: Code:
#include <iostream> |
eric.r.turner thanks man, the reason my code sucks is the fact that I'm still learning C++ I know C++ is OOP but I need to learn the basics of the language before I can code with it like a pro. But again thanks for the help with the code!
P.S. I'M: :study: :study: :study: |
All times are GMT -5. The time now is 08:15 AM. |