Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikeyredk

macrumors 65816
Original poster
Mar 13, 2003
1,267
1
how would do i use file handlers in xcode

say i wanted to open up a file that has some numbers in it

i do some arithmetic based on that file then

i output the results into a diffrent file

how????
 
i see i was suppose to put the file in the build section of the project
 
just one more if i post it here i might just get it solved had it over at spymac but nothing thats why i think macrumors is alot better cause you guys actually help people

how does xcode handle complex numbers because trying to get the example program to work
i looked through the man pages but they didn't help a bit


Code:
// includes
#include <iostream.h>
#include <complex.h>
// prototypes

// defines
#define SKIPLINE cout<<endl
///////////////////////////////////////////////////////////////////
//  Programmer: L A Vercoe   complex.cpp
//    Date Due: 10/20/97
//       Input: complex values, be sure to use complex.h
//     Process: do some complex complications
//      Output: complex numbers
//

int main(){
  //declarations
  complex z,z1,z2, i = complex(0,1);
  double x,y;

  //heading
  cout<<"\tComplex numbers"<<endl;

  //input
  cout<<"Enter in a complex value as realpart: ";
  cin >>x;
  cout<<"\tand the imaginary part: ";
  cin>>y; z = complex(x,y);
  cout<<"Input as complex number (x,y) ";
  cin>>z2;

  //<<<process & output>>> do some complex calculations
  cout<<"C's way to output complex numbers: " <<z<<endl;
  cout<<"Another way to output z: "<<real(z2)<<"+"<<imag(z2)<<"i"<<endl;
  cout<<"Multiply z by 2 + 3i = "<<complex(2,3)*z<<endl;
  z1 = sqrt(z);
  cout<<"Square root of z is "<<z1<<endl;
  cout<<"Sin(z) = "<<sin(z)<<endl;
  cout<<"2^z = "<<pow(2,z)<<endl;
  cout<<"e^(pi*i) +1 ="<<exp(M_PI*i)+1<<endl;
  //wrap up
  cout<<endl<<"End of program";

}//main()

again this is the example file he gave us

i just have to modify it for other equations which are going to be inputed
 
Re: C help

Originally posted by mikeyredk
how would do i use file handlers in xcode

say i wanted to open up a file that has some numbers in it

i do some arithmetic based on that file then

i output the results into a diffrent file

how????

You do it the same way you do it in any other environment. It's simply C++.

Your textbook probably has examples where they're opening an input stream.

You might want to try the homework on your own before asking us to do it for you again.
 
Re: Re: C help

Originally posted by bousozoku
You do it the same way you do it in any other environment. It's simply C++.

Your textbook probably has examples where they're opening an input stream.

You might want to try the homework on your own before asking us to do it for you again.

we don't have a textbook all we got was a handbook of examples and homework
hey i got to Penn State so don't expect much from the teacher especially a one that is about to retire at the end of the year

edit:
i understand how important homework is but what good is homework when you don't understand it or can't even go through the example problems
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.