Running a second Method on Online GDB

+1 vote
asked Jan 27 by Julian
So were using Online GDB for our programming class, and i was planning on making a different method for each hw problem instead of inserting the code in the int main method and have to keep going back an using different values for some of the questions, i was wondering how to make a second method on onlineGDB, i made one but when i run the program it only reads the first method which buy default is the int main(), do i need to do something specific im used to coding in C# an i figured C wasnt much different but for the life of me i cant figure out how to run the second method or why it wont run on here. I put a guide on how it looks. i know the it itsnt the code its self because when i move it into the main method the int main() it runs but wont continue reading after.

int Main()

{

///CODE For PROB1

}<--STOPS HERE

int Prob2()<--will not read this method or any code in it.

{

//CODE FOR PROBLEM 2

}

1 Answer

0 votes
answered Feb 3 by Jongbo (460 points)
You need to let the compiler knows that method is exisiting underneath main method. So you gotta declare the functino before main method like

int Prob2( );

int main(){

}

int Prob2( ){

}

like this.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...