Home > Back-end >  Extract the strings
Extract the strings

Time:09-17

#include
#include
using namespace std;
Int main () {
String STR.
Int n, a, h, m, s;
Cin> N;
While (n -) {
Cin> a;
Cin> STR;
H=(STR [0] - '0') * 10 + STR [1] - '0';
M=(STR [4] - '0') * 10 + STR [5] - '0';
S=(STR [8] - '0') * 10 + STR [9] - '0';
Cout}
}
Why input 10:30:29 this kind of type string, such as when extracting hour is (STR [0] - '0') * 10 + STR [1] - '0'
But when the minute is (STR [4] - '0') * 10 + STR [5] - '0'
Why is an empty two positions

CodePudding user response:

The colon has a space

CodePudding user response:

The cin> a; Remove and proved, breakpoints view STR content,

CodePudding user response:

reference 1/f, 5250 response:
colon have Spaces

There is no space no Spaces,

CodePudding user response:

refer to the second floor the wise know already should good karma response:
cin> a; Remove and proved, breakpoints view STR content,

The breakpoint is what?

CodePudding user response:

refer to the second floor the wise know already should good karma response:
cin> a; Remove and proved, breakpoints view STR content,

I direct output STR [2] is nothing, output STR [3] is also nothing at all

CodePudding user response:

CodePudding user response:

Clearly see Chinese symbols of the colon
  • Related