nate256 Posted September 16, 2008 Share Posted September 16, 2008 So i am starting Intro to C++ this year and we had a couple weeks of class and so far i can do little programs but I wanna use Xcode at home, but at school we use Microsoft Visual C++ 6.0. so here is an example of a code we would use in Visual #include <iostream.h> main () { cout <<"nathan is cool"; return 0; } So is the <iostream.h> what is causing me trouble? i there another header i should use? how can i get like that to work in Xcode? Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/ Share on other sites More sharing options...
RaiDesu Posted September 16, 2008 Share Posted September 16, 2008 remove the *.h at the end. Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/#findComment-893635 Share on other sites More sharing options...
nate256 Posted September 17, 2008 Author Share Posted September 17, 2008 #include <iostream> main () { cout <<"Nathan"; retutn 0; } now it doesnt see cout like what is the header i should be using??? Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/#findComment-893878 Share on other sites More sharing options...
nate256 Posted September 17, 2008 Author Share Posted September 17, 2008 ok so i figured it out a lot more here is my code for figuring out the tax on an amount of money, I know exiting #include <iostream> int main () { // insert code here... const float SALES_TAX = .06; float costOfItem, amountOfTax; std::cout <<"What is the cost of the item?\n"; std::cin >> costOfItem; amountOfTax = SALES_TAX * costOfItem; std::cout <<"You must pay "; std::cout << amountOfTax; std::cout << " dollars in taxes\n\n\n\n"; return 0; } so all i need to remeber is std:: before cout and cin is there any way to put something in the header so that i do not need to do the std::? Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/#findComment-893916 Share on other sites More sharing options...
erbic Posted September 17, 2008 Share Posted September 17, 2008 If I remember correctly, putting using namespace std; right after the includes should eliminate that problem. Namespaces are kind of a newfangled addition to C++... google it to find out more, I can't explain them all that well. Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/#findComment-893921 Share on other sites More sharing options...
nate256 Posted September 17, 2008 Author Share Posted September 17, 2008 yea i figured that out. so it is just like in Visual now but like when i get a program, is there a way to save it as like an executable file? so i could like send it to someone? Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/#findComment-893938 Share on other sites More sharing options...
RaiDesu Posted September 18, 2008 Share Posted September 18, 2008 Compile it. Choose the "build" option. Make sure you're on a release target- C++ Tools don't have extensions on *nix, really. So you'll have to copy the executable and ensure your target has the prereqs to handle it. Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/#findComment-895414 Share on other sites More sharing options...
mercurysquad Posted September 26, 2008 Share Posted September 26, 2008 You cant send a program compiled on a mac to a windows user, fyi. Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/#findComment-906385 Share on other sites More sharing options...
nate256 Posted September 26, 2008 Author Share Posted September 26, 2008 well yea but how do i make a bootable copy of the program i made in Xcode so another mac user could run it? Link to comment https://www.insanelymac.com/forum/topic/126393-visula-c-60-to-xcode-help/#findComment-906433 Share on other sites More sharing options...
Recommended Posts