Im writing a program that when given a date in the form of mm/dd/yyyy will calculate how old the person is in years... right now im stuck at getting the data as i cant figure out how to separate the data when it's entered in mm/dd/yyyy format... any suggestions?
phr0stbyt3
0
Newbie Poster
Recommended Answers
Jump to PostGreetings phr0stbyt3,
Getting the data is not difficult at all. We can either use scanf() or fgets().
scanf()
int scanf(const char *format [, argument, ...]);
> Reads data from the standard input (stdin) and stores it into the locations given by argument(s). Locations pointed by each argument are …
Jump to PostAlright,
Here are the changes:
#include <iostream> #include <stdio.h> using namespace std; void getData(int *, int *, int *); int main() { int month; int day; int year; getData(&month, &day, &year); cout << "Month: " << month << endl << "Day: " << day << endl …
All 5 Replies
Stack Overflow
8
Junior Poster
phr0stbyt3
0
Newbie Poster
phr0stbyt3
0
Newbie Poster
Stack Overflow
8
Junior Poster
phr0stbyt3
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.