Whoops you have an infinite loop here

//This creates a LCV for the do loop below and sets it equal to 0.

int y = 0;

//This do loop generates the random number.
do
{
    //This generates a random time seed.
    srand(time(0));

    //This generates a random number between 1 and 99.
    ran = rand() % 100;

    //This while controls the do loop.
}while (y != 9);

y is initialized to 0 and you are looping while y!=9. And that is just the first error, there might be more.


Bug #2

int z = 1;
//This makes the program only create a random number the first pass through the loop.
if (z < 2)
{
    //This runs the random number generator function.
    return randomgen();

    //This sets the result of the function as the random number.
    randnum = randomgen();

    //This sets the random number to the current number.
    num = randnum;
}

After fixing infinite loop in randomgen(), You are immediately returning...

Answer from Tony Tannous on Stack Overflow
๐ŸŒ
OnlineGDB
onlinegdb.com โ€บ online_c_compiler
Online C Compiler - online editor
OnlineGDB is online IDE with c compiler. Quick and easy way to compile c program online. It supports gcc compiler for c.
๐ŸŒ
OnlineGDB
onlinegdb.com
GDB online Debugger | Compiler - Code, Compile, Run, Debug online C, C++
Online GDB is online compiler and debugger for C/C++. You can compile, run and debug code with gdb online. Using gcc/g++ as compiler and gdb as debugger. Currently C and C++ languages are supported.
๐ŸŒ
OnlineGDB
onlinegdb.com โ€บ fork โ€บ S13OWDh3b
GDB online Debugger | Code, Compile, Run, Debug online C, C++
Online GDB is online ide with compiler and debugger for C/C++. Code, Compiler, Run, Debug Share code nippets.
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ online-compiler
Online C Compiler - Programiz
Write and run your C programming code using our online compiler. Enjoy additional features like code sharing, dark mode, and support for multiple languages.
๐ŸŒ
Compiler Explorer
godbolt.org
Compiler Explorer
Compiler Explorer is an interactive online compiler which shows the assembly output of compiled C++, Rust, Go (and many more) code.
๐ŸŒ
OneCompiler
onecompiler.com โ€บ c
C Online Compiler
OneCompiler's C Language editor helps you to write, compile, debug and run C code online. It's powered by GCC compiler
๐ŸŒ
Landing.Jobs
landing.jobs โ€บ home โ€บ an intermediate guide to debugging c code with online gdb c compilers
An intermediate guide to debugging C code with online GDB C compilers - Landing.Jobs
February 16, 2023 - These features can make the debugging ... Online GDB is a popular online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, and JS....
๐ŸŒ
CodeChef
codechef.com โ€บ ide
Online Compiler & IDE for Python, C++, C, Java, Rust - CodeChef
Compile & run your code with the CodeChef online IDE. Our online compiler supports multiple programming languages like Python, C++, C, JavaScript, Rust, Go, Kotlin, and many more.
Find elsewhere
Top answer
1 of 2
3

Whoops you have an infinite loop here

//This creates a LCV for the do loop below and sets it equal to 0.

int y = 0;

//This do loop generates the random number.
do
{
    //This generates a random time seed.
    srand(time(0));

    //This generates a random number between 1 and 99.
    ran = rand() % 100;

    //This while controls the do loop.
}while (y != 9);

y is initialized to 0 and you are looping while y!=9. And that is just the first error, there might be more.


Bug #2

int z = 1;
//This makes the program only create a random number the first pass through the loop.
if (z < 2)
{
    //This runs the random number generator function.
    return randomgen();

    //This sets the result of the function as the random number.
    randnum = randomgen();

    //This sets the random number to the current number.
    num = randnum;
}

After fixing infinite loop in randomgen(), You are immediately returning...

2 of 2
1

you have two problems in your code: the first one is that you have infinite loop in randomgen() function the condition in check against y - y != 9 but the value never update

int randomgen() 
{
    //This creates a variable to store the random number.
    int ran;

    //This creates a LCV for the do loop below and sets it equal to 0.
    int y = 0;

    //This do loop generates the random number.
    do
    {
        //This generates a random time seed.
        srand(time(0));

        //This generates a random number between 1 and 99.
        ran = rand() % 100;

        //This while controls the do loop.
    }while (y != 9);

    //This returns the random number for use in the rest of the program.
    return ran;
}

and the second one is even if you pass the loop in the function you exit main right away because the call to the function randomgen() is with return

if (z < 2)
{
    //This runs the random number generator function.
    return randomgen(); <-- **second problome**

    //This sets the result of the function as the random number.
    randnum = randomgen();

    //This sets the random number to the current number.
    num = randnum;
}
๐ŸŒ
WebCatalog
webcatalog.io โ€บ home โ€บ apps โ€บ software development โ€บ onlinegdb โ€บ desktop app
OnlineGDB - Desktop App for Mac, Windows (PC) - WebCatalog
Check important info. Online GDB is online compiler and debugger for C/C++. You can compile, run and debug code with gdb online. Using gcc/g++ as compiler and gdb as debugger.
๐ŸŒ
JDoodle
jdoodle.com โ€บ c-online-compiler
Online Compiler and Editor/IDE for Java, C, C++, PHP, Python, Ruby, Perl - Code and Run Online
JDoodle is an Online Compiler, Editor, IDE for Java, C, C++, PHP, Perl, Python, Ruby and many more. You can run your programs on the fly online, and you can save and share them with others. Quick and Easy way to compile and run programs online.
๐ŸŒ
BibSonomy
bibsonomy.org โ€บ url โ€บ 8d06f8668c3dfd984211b57b46ba60f1
GDB online Debugger - Code, Compile, Run, Debug online C, C++ | BibSonomy
compiler ยท cpp ยท debugger ยท gdb ยท ide ยท online ยท webapp ยท @cnp 9 years ago ยท (last updated 9 years ago) References ยท Bookmarks ยท deleting review ยท Please log in to take part in the discussion (add own reviews or comments).
๐ŸŒ
FastBit
fastbitlab.com โ€บ home โ€บ microcontroller embedded c programming lecture 15| online gdb web tool
Online GDB web tool - Your Virtual Compiler and Debugger
June 7, 2024 - Online GDB web tool is an online compiler and debugging tool supporting multiple programming languages like C, C++, Java and more.
๐ŸŒ
LogicMojo
logicmojo.com โ€บ online-gdb-compiler
Online GDB Compiler By Logicmojo
It is the world's first online IDE with an integrated gdb debugger that allows debugging. It does not demand the download and installation of any software on your pc. A useful web tool for coders who enjoy coding online.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ compilers โ€บ online-c-compiler.htm
Online C Compiler & IDE - Write, Run & Debug C Code
Free online C Compiler and IDE. Write, compile, run and debug C code online. No installation required. Supports debugging, code sharing, and multiple examples.
๐ŸŒ
Programiz
programiz.com โ€บ cpp-programming โ€บ online-compiler
Online C++ Compiler - Programiz
Write and run your C++ code using our online compiler. Enjoy additional features like code sharing, dark mode, and support for multiple programming languages.
๐ŸŒ
Ideone
ideone.com โ€บ fork โ€บ zWurpK
Online Compiler and IDE >> C/C++, Java, PHP, Python, Perl and 70+ other compilers and interpreters - Ideone.com
Ideone is something more than a pastebin; it's an online compiler and debugging tool which allows to compile and run code online in more than 40 programming languages.