Results 1 to 4 of 4

Thread: Sams Book p.170

  1. #1
    DaoK
    Guest

    Sams Book p.170

    I tryed to make that exercice ( 7.3) for fun and I got 3 errors who I cannot solve.

    THis is my code :

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    	unsigned short small;
    	unsigned short large;
    	const unsigned short MAXSMALL=65535;
    
    	cout<<"Enter a small number: ";
    	cin >> small;
    	cout<<"Enter a large number: ";
    	cin >> large;
    	cout<< "Your small number is : " <<small<<"...";
    
    	while (small < large && large > 0 && small < MAXSMALL)
    	{
    		if (small % 5000 ==0)
    			cout<<".";
    		small++;
    		large-=2;
    	}
    
    	cout << "\nSmall: " << small << "\nLarge: " << large <<endl;
    	return 0;
    }
    This is the errors :
    Configuration: LoopBaby - Win32 DebugCompiling...
    loopWhile.cpp
    Linking...
    loopWhile.obj : error LNK2005: _main already defined in WHile.obj
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/LoopBaby.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    LoopBaby.exe - 3 error(s), 0 warning(s)

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Make sure you are making a console app and not a win32 one.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    DaoK
    Guest
    ok I will check that after dinner.

  4. #4
    DaoK
    Guest
    Yes that was the error oops

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