Having A Hard Time with Subroutines

Here's some background. I enrolled last year in an Introduction to C++ course, which I did pretty well in. So I thought I'd test my programs on new IDEs (we used Visual Studio 6.0) and work off from there.

DL Link (.7z) to the latter half of my files for that class: http://www.mediafire.com/download.php?257szk3ozu4817w

Problem: Turns out everything I know about C++ is a lie. To give a general scope about how different our instruction was from the real thing:

The IDE already did this: using namespace std; , but didn't say it did. We had no idea it existed for the most part.

So now whenever I try to run one of my oldies, I am given this in Code::Blocks:

error: expected constructor, destructor, or type conversion before ';' token

Here is a link to a proper screenshot. http://puu.sh/1UBpd
Last edited on
Problem: Turns out everything I know about C++ is a lie.

That was an awfully vague statement.

What makes you think that the IDE did something without saying it? What do you mean when you say you had no idea that it existed? Based on your screen shot, it appears that you forgot to enclose a comment within the proper start tag for a comment. It's flagging an error for a bunch of statements that look like they are part of a comment.
Those lines you show look like function calls, which can't be outside of a function. Did you forget to put in an int main() {}? Or maybe a comment, as kempofighter suggested?
Seems like you didn't the joke bro. I didn't alter these programs. At all. At. All. That means there are lots of things about subroutines I need to relearn. When I say I had no idea it existed I mean I had no idea that there was a command called using, that there was such things as namespaces, and I didn't know that standard was one of those things.

The IDE, by default, said we were using namespace std. There were lots of things I don't understand about the crazy wacky custom Visual Studio 6 the school uses. It crashed the entire thing completely if you so much as clicked Open instead of clicking on the cpp file.

That was then and this is now.

This is how we declared subroutines.


To me, this said that the program should declare five new functions/subroutines/whathaveyou called newroll, addname, viewroll, searchroll, and mainmenu.

Now do you see what I mean when I say 'everything I know is a lie'? I tried to declare subprograms and you thought I was making a comment describing my program. :(


I forgot nothing, I simply do not know. At all. I'm sorry for wasting your time with my foolishness but I essentially have to relearn half of my stuff from scratch because what I know is errors, makes no sense to real programmers, or is good if I want to make text display on a console application.

And I'm trying to declare functions. I do have an int main(), it's lower down, but I also didn't know you had to call main() an int, which seems silly to me, and my programs work in Code::Blocks without calling it an integer.

Here's a very simple program to show you what I know basically:

// Quinn Holt
// January 29, 2013
// This program declares an integer, a, and gives it a value of five. 
//Afterwards, it displays "My C++ program." before asking for an input for the integer a.
//Then it ends the program.

#include <iostream>

using namespace std;

 int a=5;
 cout << "My C++ program." << endl;
 cin >> a;
 return 0;

Last edited on
That feels like some kind of really old version of C or C++ back when "default-int" existed. Maybe those kinds of function declarations were used back then. If that's what you learned, you're probably right. The tutorial on this site is pretty good IMO, you you can take a look at that if you want and see if it helps.
Thanks a ton, Zhuge, you helped a lot. Kempo also helped somewhat, thanks for that.
Topic archived. No new replies allowed.