cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Problem with strtok
Problem with strtok
May 28, 2012 at 6:33pm UTC
Oskar Liblik
(4)
Hi, I have problem. I need to printf how long is one company opened. Data is in txt file. For example I got company A and it is opened
M-F 11-19
(monday to friday) I need to printf that this company is opened 8 hours.
Got any ideas? :)
May 28, 2012 at 6:35pm UTC
vlad from moscow
(6539)
What is the general format of such string?
Last edited on
May 28, 2012 at 6:35pm UTC
May 28, 2012 at 6:40pm UTC
Oskar Liblik
(4)
int hours(char*);
May 28, 2012 at 7:06pm UTC
closed account (
o3hC5Di1
)
I think Mr. Vlad meant, is the format of the opening hours always
[1 letter]-[1letter] [number]-[number] ?
If that is the case, you can use the scanf() function to assign the numbers to integer variables, after which you can make calculations with them.
See http://www.cplusplus.com/reference/clibrary/cstdio/scanf/ for more information on how to do so.
Hope that helps.
All the best,
NwN
Last edited on
May 28, 2012 at 7:06pm UTC
Topic archived. No new replies allowed.