Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Running a second Method on Online GDB

+1 vote
asked Jan 27, 2020 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, 2020 by Jongbo (470 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.
...