Hi,
I need help compiling in the command utility tool for Xcode. When I compile my source file, everything works fine, but when I go and make changes to the CPP source file, the compile won't compile the changes. It instead, compiles the original source file [without all the changes]. Can anybody help me?
This is the process I use to compile:
1. select command utility tool C++
2. New Project
3. Open main.cpp
4. paste source code
5. compile
My laptop:
Macbook with Tiger
Xcode 2.5
----
here is the original source file:
and here is the updated source code i want to compile:
any help would be appreciated!
regards,
Eymon
I need help compiling in the command utility tool for Xcode. When I compile my source file, everything works fine, but when I go and make changes to the CPP source file, the compile won't compile the changes. It instead, compiles the original source file [without all the changes]. Can anybody help me?
This is the process I use to compile:
1. select command utility tool C++
2. New Project
3. Open main.cpp
4. paste source code
5. compile
My laptop:
Macbook with Tiger
Xcode 2.5
----
here is the original source file:
#include<iostream>
#include<iomanip>
using namespace std;
struct time
{
int month;
int date;
int year;
int hr;
int min;
int sec;
}part1,part2,part3;
int timeinfo()
{
cout<<setw(16)<<"Todays' date is:"<<endl;
cout<<setw(2)<<part1.month<<"/"<<setw(2)<<part1.date<<"/"<<setw(4)<<part1.year<<endl;
cout<<setw(16)<<"Your Time-in is:"<<endl;
cout<<setw(2)<<part1.hr<<"::"<<setw(2)<<part1.min<<endl<<endl;
cout<<setw(16)<<"Your Time-out is:"<<endl;
cout<<setw(2)<<part2.hr<<"::"<<setw(2)<<part2.min<<endl<<endl;
cout<<setw(25)<<"\n\nYour Total Work Time is: "<<setw(2)<<part3.hr<<"hrs"
<<setw(2)<<part3.min<<"min"<<setw(2)<<part3.sec<<"sec"<<endl;
};
int main()
{
int timein;
int timeout;
int total,count,totalseconds;
total=0;
count=0;
cout<<"Good Morning!"<<endl<<endl;
cout<<"This is a Payroll Program that records your total hours worked"<<endl;
cout<<"Please enter all your time in MILITARY Time Format"<<endl;
cout<<"12 AM = 00 hours"<<endl;
cout<<"Please refer to this chart:"<<endl<<endl;
cout<<"Regular Clock [AM]: 12 1 2 3 4 5 6 7 8 9 10 11"<<endl;
cout<<"Military Time [AM]: 00 1 2 3 4 5 6 7 8 9 10 11"<<endl;
cout<<"Regular Clock [PM]: 12 1 2 3 4 5 6 7 8 9 10 11"<<endl;
cout<<"Military Time [PM]: 12 13 14 15 16 17 18 19 20 21 22 23"<<endl<<endl<<endl;
cout<<"Enter today's month: "<< endl;
cin>>part1.month;
cout<<"Enter today's date: "<< endl;
cin>>part1.date;
cout<<"Enter today's year: "<< endl;
cin>>part1.year;
cout<<endl<<endl;
cout<<"Enter Time in hour[military time]: "<< endl; //timein
cin>>part1.hr;
cout<<"Enter Time in minutes: "<< endl;
cin>>part1.min;
part1.sec=0;
cout<<endl;
cout<<endl; //timeout
cout<<"Enter Time out hour[military time]: "<< endl;
cin>>part2.hr;
cout<<"Enter Time out minutes: "<< endl;
cin>>part2.min;
part2.sec=0;
cout<<endl;
// Calculations
timeout = (part2.hr*360) + (part2.min*60);
timein = (part1.hr*360) + (part1.min*60);
totalseconds=timeout-timein;
part3.hr=totalseconds/360;
totalseconds=totalseconds%360;
part3.min=totalseconds/60;
totalseconds=totalseconds%60;
part3.sec=totalseconds;
cout<<endl;
cout<<timeinfo()<<endl;
return 0;
}
and here is the updated source code i want to compile:
#include<iostream>
#include<iomanip>
#include <fstream>
using namespace std;
/////////////////////////////////////////////////////////////////////////////////
struct time
{
int month;
int date;
int year;
int hr;
int min;
int sec;
}part1,part2,part3; //part1=time in , part2= timeout, part3= total time
/////////////////////////////////////////////////////////////////////////////////////
int timeinfo() // displays timecard info at end
{
cout<<setw(16)<<"Todays' date is:"<<endl;
payroll<<<<setw(16)<<"Todays' date is:"<<endl;
cout<<setw(2)<<part1.month<<"/"<<setw(2)<<part1.date<<"/"<<setw(4)<<part1.year<<endl;
payroll<<setw(2)<<part1.month<<"/"<<setw(2)<<part1.date<<"/"<<setw(4)<<part1.year<<endl;
cout<<setw(16)<<"Your clock-in is:"<<endl;
payroll<<setw(16)<<"Your clock-in is:"<<endl;
cout<<setw(2)<<part1.hr<<":"<<setw(2)<<part1.min<<endl;
payroll<<setw(2)<<part1.hr<<":"<<setw(2)<<part1.min<<endl;
cout<<setw(16)<<"Your clock-out is:"<<endl;
payroll<<setw(16)<<"Your clock-out is:"<<endl;
cout<<setw(2)<<part2.hr<<":"<<setw(2)<<part2.min<<endl;
payroll<<setw(2)<<part2.hr<<":"<<setw(2)<<part2.min<<endl;
cout<<setw(25)<<"\n\nYour Total Work Time is: "<<setw(2)<<part3.hr<<"hrs"
<<setw(2)<<part3.min<<"min"<<setw(2)<<part3.sec<<"sec"<<endl;
payroll<<setw(25)<<"\n\nYour Total Work Time is: "<<setw(2)<<part3.hr<<"hrs"
<<setw(2)<<part3.min<<"min"<<setw(2)<<part3.sec<<"sec"<<endl;
cout<<"Do another time calculation? Enter Y or N:";
}
//////////////////////////////////////////////////////////////////////////////////////
int main()
{
ofstream payroll;
payroll.open("payroll.txt"); //write a file
int timein;
int timeout;
int total,count,totalseconds;
total=0;
count=0;
cout<<"Good Morning!"<<endl<<endl; // welcome messages
cout<<"This is a Payroll Program that records your total hours worked"<<endl;
cout<<"Please enter all your time in MILITARY Time Format"<<endl;
cout<<"12 AM = 00 hours"<<endl;
cout<<"Please refer to this chart:"<<endl<<endl;
cout<<"Regular Clock [AM]: 12 1 2 3 4 5 6 7 8 9 10 11"<<endl;
cout<<"Military Time [AM]: 00 1 2 3 4 5 6 7 8 9 10 11"<<endl;
cout<<"Regular Clock [PM]: 12 1 2 3 4 5 6 7 8 9 10 11"<<endl;
cout<<"Military Time [PM]: 12 13 14 15 16 17 18 19 20 21 22 23"<<endl<<endl<<endl;
char character; //For Y/N Do Loop
do //Begin Do Loop
{
cout<<"Enter today's month: "<< endl;
paroll<<"Enter today's month: "<< endl;
cin>>part1.month;
cout<<"Enter today's month: "<< endl;
payroll<<"Enter today's month: "<< endl;
cin>>part1.date;
cout<<"Enter today's year: "<< endl;
payroll<<"Enter today's year: "<< endl;
cin>>part1.year;
cout<<endl<<endl;
cout<<"Enter Time in hour[military time]: "<< endl;
payroll<<"Enter Time in hour[military time]: "<< endl; //timein
cin>>part1.hr;
cout<<"Enter clock in minutes: "<< endl;
payroll<<"Enter clock in minutes: "<< endl;
cin>>part1.min;
part1.sec=0;
cout<<endl;
cout<<endl; //timeout
cout<<"Enter clock out hour[military time]: "<< endl;
payroll<<"Enter clock out hour[military time]: "<< endl;
cin>>part2.hr;
cout<<"Enter clock out minutes: "<< endl;
payroll<<"Enter clock out minutes: "<< endl;
cin>>part2.min;
part2.sec=0;
cout<<endl;
// Calculations
timeout = (part2.hr*360) + (part2.min*60);
timein = (part1.hr*360) + (part1.min*60);
totalseconds=timeout-timein;
part3.hr=totalseconds/360;
totalseconds=totalseconds%360;
part3.min=totalseconds/60;
totalseconds=totalseconds%60;
part3.sec=totalseconds;
cout<<endl;
cout<<timeinfo()<<endl;
payroll<<timeinfo()<<endl;
}while((character != 'N' ) && (character != 'n'));
payroll.close();
return 0;
}
any help would be appreciated!
regards,
Eymon