im working on something and i need the user to be able to enter times that things start and end. i need to know how i can store that and then compare them later. they need to be able to enter like 12:45. i was thinking i could somehow ignore the colon or something and just store 1245 as an int but i dont know how. any help is appreciated.

error checking and "dummy proofing" aside, you can probably store the input value to a string variable, then use the string methods with loops to process the string. Specifically, erase and find_first_of may be of interest:
http://www.cplusplus.com/reference/string/string/

to get integer from a string, use atoi(strConvert.c_str())

I would imagine actually getting it to work is your homework or something, so I won't give a detailed solution.

You could try the scanf function...

int h,m;
scanf("%d:%d",&h,&m);

You can enter the time as xx:xx

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.