CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2013
    Posts
    3

    i dont have any errors but im not getting any output

    i am working on a project and i am just trying to get it to run. when i debug it says i have no errors but i dont get any output it just says

    'Win32Project1.exe' (Win32): Loaded 'C:\Users\dann\Documents\Visual Studio 2012\Projects\Win32Project1\Debug\Win32Project1.exe'. Symbols loaded.
    'Win32Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
    'Win32Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
    'Win32Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
    'Win32Project1.exe' (Win32): Loaded 'C:\ProgramData\Norton\{0C55C096-0F1D-4F28-AAA2-85EF591126E7}\N360_20.2.0.19\Definitions\BASHDefs\20131203.001\UMEngx86.dll'. Cannot find or open the PDB file.
    'Win32Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded.
    'Win32Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
    The thread 0x2590 has exited with code 0 (0x0).
    The program '[9160] Win32Project1.exe' has exited with code 0 (0x0).

    any help you could give me would be greatly appreciated. the code is

    Code:
    #include <iostream>
    #include <cstdlib>
    #include <cmath>
    #include <ctime>
    #include <iomanip>
    #include <cctype>
    using namespace std;
    
    
    int turn[3] = {0,0,0};
    
    
    int main()
    {
    	int srand (time(0));
    	int playerScore = 0;
    
    	playerScore = turn[0];
    	if (playerScore< 13)
    	{
    		void roll();
    	}
    	else
    	{
    		cout<< "congradulations you won!";
    	}
    	return 0;
    }
    
    void roll()
    {
    	int s;
    
    	for (int x=1; x < 4; x++)
    	{
    	s = rand()%13;
    
    	if (s<6)
    	{
    		void greenDice();
    	}
    	else if(s>5 && s<9)
    	{
    		void yellowDice();
    	}
    	else if(s>8)
    	{
    		void redDice();
    	}
    	}
    }
    void greenDice()
    {
    	int g;
    
    	g = rand()%6;
    
    	if (g<3)
    	{
    		int fish();
    	}
    	else if(g>2 && g<5)
    	{
    		int hook();
    	}
    	else if(g>4)
    	{
    		int boot();
    	}
    }
    void yellowDice()
    {
    	int y;
    
    	y = rand()%6;
    
    	if (y<2)
    	{
    		int fish();
    	}
    	else if(y>1 && y<4)
    	{
    		int hook();
    	}
    	else if(y>3)
    	{
    		int boot();
    	}
    }
    void redDice()
    {
    	int r;
    
    	r = rand()%6;
    
    	if (r<1)
    	{
    		void fish();
    	}
    	else if(r>0 && r<3)
    	{
    		void hook();
    	}
    	else if(r>2)
    	{
    		void boot();
    	}
    }
    void fish()
    {
    	cout<< "You rolled a fish";
    	++ turn[0];
    }
    void hook()
    {
    	cout << "You rolled a hook";
    	++ turn[1];
    }
    void boot()
    {
    	cout <<"You rolled a boot.";
    	++ turn[2];
    }
    void reroll(int turn[2])
    {
    	int bOOTS = turn[2];
    	char again;
    
    	cout << "Would you like to roll again Y or N?";
    	cin >> again;
    	
    	if(again == 'Y' && bOOTS < 3)
    	{
    		roll();
    	}
    }
    Last edited by VictorN; December 4th, 2013 at 03:44 AM. Reason: code tags were added

  2. #2
    Join Date
    Jun 2002
    Location
    Stockholm, Sweden
    Posts
    1,641

    Re: i dont have any errors but im not getting any output

    Quote Originally Posted by dthunderchunky View Post
    Code:
    	if (playerScore< 13)
    	{
    		void roll();
    	}
    void roll(); means a function declaration. To call the actual function, you should just use roll();

    The void roll(); typically belongs in your header file, it is called a forward declaration, and may be required so that all functions know that the "roll" function exists.

    As a beginner, you really need to learn to use the debugger. If you did, you would quickly realize that roll was never getting called in this specific case.
    Nobody cares how it works as long as it works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured