Not runing property



 DEVELOP > c-Plus-Plus > Not runing property

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Latina"
Date: 07 Nov 2007 10:49:28 PM
Object: Not runing property
Hi, I hope some one can help me.
For some reason is not going to the function.
I dont have any errors.
Here is my code:
#include <iomanip>
#include <iostream>
using namespace std;
int calYrs(int, int);
int main()
{
int day1, day2;
int month1, month2;
int year1, year2;
int years;
cout<<" WELCOME to the Date Program\n\n";
cout<<"This program is going to determine the time that has
passed ";
cout<<"between two dates.\n";
cout<<"Please enter the dates.\nIt can be your birthday or
todays date\n";
cout<<"\nEnter the first date\nDay: ";
cin>>day1;
cout<<"Month: ";
cin>>month1;
if(month1>12||month1<=0)
{
cout<<"The month must be between 1 and 12\nPlease re-enter
month\n";
cin>>month1;
}
cout<<"Year: ";
cin>>year1;
cout<<"Enter the second date\nDay: ";
cin>>day2;
cout<<"Month: ";
cin>>month2;
if(month2>12||month2<=0)
{
cout<<"The month must be between 1 and 12\nPlease re-enter
month\n";
cin>>month2;
}
cout<<"Year: ";
cin>>year2;
years = calYrs(year1, year2);
cout<<"Total: "<<years;
return 0;
}
int calYrs(int y1, int y2)
{
int years;
if(y1>y2)
{
years=y1-y2;
}
else
{
years=y2-y1;
}
return years;
}
Thanks
.

User: "red floyd"

Title: Re: Not runing property 07 Nov 2007 11:09:34 PM
Latina wrote:

Hi, I hope some one can help me.

For some reason is not going to the function.
I dont have any errors.

What is your input? What were you expecting to happen? How do you know
it's not going to 'the function'?

Here is my code:


#include <iomanip>
#include <iostream>
using namespace std;


int calYrs(int, int);


int main()
{
int day1, day2;
int month1, month2;
int year1, year2;
int years;


cout<<" WELCOME to the Date Program\n\n";
cout<<"This program is going to determine the time that has
passed ";
cout<<"between two dates.\n";
cout<<"Please enter the dates.\nIt can be your birthday or
todays date\n";
cout<<"\nEnter the first date\nDay: ";
cin>>day1;
cout<<"Month: ";
cin>>month1;
if(month1>12||month1<=0)
{
cout<<"The month must be between 1 and 12\nPlease re-enter
month\n";
cin>>month1;
}
cout<<"Year: ";
cin>>year1;
cout<<"Enter the second date\nDay: ";
cin>>day2;
cout<<"Month: ";
cin>>month2;
if(month2>12||month2<=0)
{
cout<<"The month must be between 1 and 12\nPlease re-enter
month\n";
cin>>month2;
}
cout<<"Year: ";
cin>>year2;


years = calYrs(year1, year2);


cout<<"Total: "<<years;


return 0;



}


int calYrs(int y1, int y2)
{
int years;

if(y1>y2)
{
years=y1-y2;
}
else
{
years=y2-y1;
}
return years;


}


Thanks

.

User: "Rolf Magnus"

Title: Re: Not runing property 07 Nov 2007 11:14:13 PM
Latina wrote:

Hi, I hope some one can help me.

For some reason is not going to the function.
I dont have any errors.

What exactly happens? How do you know that the function isn't called?
Your code does work here.
.
User: "Latina"

Title: Re: Not runing property 07 Nov 2007 11:22:51 PM
On Nov 7, 11:14 pm, Rolf Magnus <ramag...@t-online.de> wrote:

Latina wrote:

Hi, I hope some one can help me.


For some reason is not going to the function.
I dont have any errors.


What exactly happens? How do you know that the function isn't called?
Your code does work here.

After I enter the second year and I press enter,
the program terminates.
This is my output:
WELCOME to the Date Program
This program is going to determine the time that has passed between
two dates.
Please enter the dates.
It can be your birthday or todays date
Enter the first date
Day: 1
Month: 12
Year: 2000
Enter the second date
Day: 4
Month: 3
Year: 2004
.
User: "Jim Langston"

Title: Re: Not runing property 07 Nov 2007 11:28:02 PM
"Latina" <sdlt85@gmail.com> wrote in message
news:1194499371.701098.185800@o38g2000hse.googlegroups.com...

On Nov 7, 11:14 pm, Rolf Magnus <ramag...@t-online.de> wrote:

Latina wrote:

Hi, I hope some one can help me.


For some reason is not going to the function.
I dont have any errors.


What exactly happens? How do you know that the function isn't called?
Your code does work here.



After I enter the second year and I press enter,
the program terminates.
This is my output:

WELCOME to the Date Program

This program is going to determine the time that has passed between
two dates.
Please enter the dates.
It can be your birthday or todays date

Enter the first date
Day: 1
Month: 12
Year: 2000
Enter the second date
Day: 4
Month: 3
Year: 2004

"Terminates". Are you running on Windows? And by terminates do you mean
the program text window closes? And are you running it by pressing F5?
Try running it with ctrl-F5, which will pause before it closes so you can
see the output. Or wait for something at the end before it closes. Such as
putting
std::string Wait;
std::cin >> Wait;
at the bottom of main.
.
User: "Latina"

Title: Re: Not runing property 07 Nov 2007 11:29:47 PM
On Nov 7, 11:28 pm, "Jim Langston" <tazmas...@rocketmail.com> wrote:

"Latina" <sdl...@gmail.com> wrote in message

news:1194499371.701098.185800@o38g2000hse.googlegroups.com...





On Nov 7, 11:14 pm, Rolf Magnus <ramag...@t-online.de> wrote:

Latina wrote:

Hi, I hope some one can help me.


For some reason is not going to the function.
I dont have any errors.


What exactly happens? How do you know that the function isn't called?
Your code does work here.


After I enter the second year and I press enter,
the program terminates.
This is my output:


WELCOME to the Date Program


This program is going to determine the time that has passed between
two dates.
Please enter the dates.
It can be your birthday or todays date


Enter the first date
Day: 1
Month: 12
Year: 2000
Enter the second date
Day: 4
Month: 3
Year: 2004


"Terminates". Are you running on Windows? And by terminates do you mean
the program text window closes? And are you running it by pressing F5?

Try running it with ctrl-F5, which will pause before it closes so you can
see the output. Or wait for something at the end before it closes. Such as
putting
std::string Wait;
std::cin >> Wait;
at the bottom of main.- Hide quoted text -

- Show quoted text -

Thanks, I got it ^_^
.
User: "Latina"

Title: Re: Not runing property 07 Nov 2007 11:36:02 PM

"Terminates". Are you running on Windows? And by terminates do you mean
the program text window closes? And are you running it by pressing F5?


Try running it with ctrl-F5, which will pause before it closes so you can
see the output. Or wait for something at the end before it closes. Such as
putting
std::string Wait;
std::cin >> Wait;
at the bottom of main.- Hide quoted text -


- Show quoted text -


Thanks, I got it ^_^- Hide quoted text -

- Show quoted text -

But after is printing the total, the window doesnt close.
.
User: "Jim Langston"

Title: Re: Not runing property 08 Nov 2007 01:13:36 AM
"Latina" <sdlt85@gmail.com> wrote in message
news:1194500162.843534.235260@z9g2000hsf.googlegroups.com...

"Terminates". Are you running on Windows? And by terminates do you
mean
the program text window closes? And are you running it by pressing F5?


Try running it with ctrl-F5, which will pause before it closes so you
can
see the output. Or wait for something at the end before it closes.
Such as
putting
std::string Wait;
std::cin >> Wait;
at the bottom of main.- Hide quoted text -


- Show quoted text -


Thanks, I got it ^_^- Hide quoted text -

- Show quoted text -


But after is printing the total, the window doesnt close.

Press enter.
.
User: "Latina"

Title: Re: Not runing property 08 Nov 2007 09:11:42 AM

But after is printing the total, the window doesnt close.


Press enter.

Still, only when I enter something closes.
.





User: "Latina"

Title: Re: Not runing property 07 Nov 2007 11:27:07 PM
On Nov 7, 11:22 pm, Latina <sdl...@gmail.com> wrote:
On Nov 7, 11:14 pm, Rolf Magnus <ramag...@t-online.de> wrote:

Latina wrote:

Hi, I hope some one can help me.
For some reason is not going to the function.
I dont have any errors.

What exactly happens? How do you know that the function isn't called?
Your code does work here.

After I enter the second year and I press enter,
the program terminates.
It suppose to print out the difference of the two years.
This is my output:
WELCOME to the Date Program
This program is going to determine the time that has passed between
two dates.
Please enter the dates.
It can be your birthday or todays date
Enter the first date
Day: 1
Month: 12
Year: 2000
Enter the second date
Day: 4
Month: 3
Year: 2004
.




  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER