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 February 16th, 2005, 01:38 PM
ChiPhiZD ChiPhiZD is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 2 ChiPhiZD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 31 sec
Reputation Power: 0
Question Using C++ in .net and the sqrt()

I am trying to create a program that will decipher whether a number is prime or composite. I am hitting a few roadblocks. First of all .net will not allow me to use the sqrt() command, but yet when I put in the same exact code into Visual Studio 6.0 it allows me to do so, what command can I use in .net to allow me to create this program.

This is what I have so far (mind all of you, I am a college student just getting into the C++ programming field, I have basic and java knowlegde, so I am not totally oblivious)

#include <iostream>
#include <cmath>

using namespace std;

int main()
{

int i = 2;
int x;

cout << "Enter an interger and this program will tell whether it is prime or composite. " << endl;
cin >> x;

while (i <= sqrt(x))
cout <<




system("PAUSE")
return 0

}


Now the professor is saying that we have to use the sqrt() command for this program, I have figured out how to create a program that will decipher prime by using for loops with an if/else inside the for loop.

Any help would be GREATLY APPRECIATE and thanks in advance,
Chris

Reply With Quote
  #2  
Old February 16th, 2005, 01:39 PM
ChiPhiZD ChiPhiZD is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 2 ChiPhiZD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 31 sec
Reputation Power: 0
Oh and FYI i cannot even put the following code into C++

cout << sqrt(9) << endl;

even that will not work

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Using C++ in .net and the sqrt()


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway