473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

Nov 8 '07 #1
9 1274
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
Nov 8 '07 #2
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.

Nov 8 '07 #3
On Nov 7, 11:14 pm, Rolf Magnus <ramag...@t-online.dewrote:
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

Nov 8 '07 #4
"Latina" <sd****@gmail.comwrote in message
news:11**********************@o38g2000hse.googlegr oups.com...
On Nov 7, 11:14 pm, Rolf Magnus <ramag...@t-online.dewrote:
>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.
Nov 8 '07 #5
On Nov 7, 11:22 pm, Latina <sdl...@gmail.comwrote:
On Nov 7, 11:14 pm, Rolf Magnus <ramag...@t-online.dewrote:
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
Nov 8 '07 #6
On Nov 7, 11:28 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:
"Latina" <sdl...@gmail.comwrote in message

news:11**********************@o38g2000hse.googlegr oups.com...


On Nov 7, 11:14 pm, Rolf Magnus <ramag...@t-online.dewrote:
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 ^_^

Nov 8 '07 #7
"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.

Nov 8 '07 #8
"Latina" <sd****@gmail.comwrote in message
news:11**********************@z9g2000hsf.googlegro ups.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.
Nov 8 '07 #9
But after is printing the total, the window doesnt close.
>
Press enter.
Still, only when I enter something closes.

Nov 8 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eddie | last post by:
Ase well as System.Assembly.GetExecutingAssembly.Location you can also you System.Assembly.GetExecutingAssembly.CodeBase The Location property does return the location of the assembly, even if...
3
by: Johnny M | last post by:
using Access 2003 Pardon the subject line, but I don't have a better word for this strange behavior (or behavior I don't understand!!!) I have a class module named DepreciationFactor. One of...
3
by: dahuzizyd | last post by:
Hi all I want to judge an application is runing or not when another application start . If the application is running , get focus. I use the Pinvoke to invoke the FindWindow function ,I...
1
by: Joey | last post by:
I am using the below code to run a dos based program. While it is running you can hit ctrl-c to cancel the process. Does anyone know how I can send the same keystroke to the already runing...
5
by: mastar | last post by:
Hi all im trying to run a file localy on my server (2003) using asp , this is the code : <%@ LANGUAGE = "JAVASCRIPT" %> <% var commandLine = "File_NAME.EXE"; var WshShell =...
2
by: atiq | last post by:
why isn't my Access giving me warning before runing the delete, append or update query because usually it warns you that you are about to append, update or delete the following number of records. It...
0
by: smugcool | last post by:
hi, I have made a project on vb 6.0. And i have made a setup file for the same. When i am runing this file in WINDOWS XP, its running absolutly fine. But the same setup file when i try to run...
0
by: PanchalRakesh | last post by:
Dear All, I am Developing a window service in which i am continously check which program runing currently in my computer memory for how many time , in which memory address and when it start and...
7
by: colin | last post by:
Hi, Ive written a 3dmodel editor, and it works fairly well it harldy uses any cpu exept when its loading a texture from bitmap in the debugger, at all other times it hardly uses any cpu but from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.