C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 14th, 2015, 05:54 PM
AnxiousBarbecue AnxiousBarbecue is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2015
Posts: 1 AnxiousBarbecue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 7 sec
Reputation Power: 0
General - I am getting error LNK2005 and LNK1169

#include<iostream>
using namespace std;

int main()
{
int a = 0; // main factors of 2
int b = 2; // starts at 3 officially for factors > 2
int c = 0; // just a counter for while loop
int holder[10]; // hold the numbers for the factors
int done = 0;
int num = 0;

cout << "Please, enter an integer : ";
cin >> a;
while (done == 0) //while numbers > 1 still exist
{
if (a % 2 == 0)
{
a = a / 2;
holder[num] = 2;
}
else if (a % 2 != 0) // if 2 is no longer a factor
{
while (c == 0)
{
b++; // starts with b++ so b-- in the next
if (a%b == 0) // iteration will repeat itself if there
{ // is more than one odd factor of the same num
holder[num] = b;
a = a / b;
b--;
num++;
}
if (a == 1) // if no factors are left then leave loops
{
c++;
done = 1;
}
}
}
num++;
}

cout << endl;
for (int temp = 0; num>0; num--) // just prints the numbers
{
if (holder[temp] >= 0)
{
cout << holder[temp] << endl;
}
temp++;
}

return 0;
}

Reply With Quote
  #2  
Old May 14th, 2015, 02:11 AM
Thinias Thinias is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 78 Thinias User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 58 m 48 sec
Reputation Power: 8
Code here looks fine to me. Compiles fine on my end as well. I'd suspect something about your project/build configuration. Check to make sure you aren't linking against Win32 or something like that - some of these libs will define your main() function for you, expecting you to implement _tmain() instead.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > General - I am getting error LNK2005 and LNK1169


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap