time conversion hackerrank solution in c++
C++
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<cstring>
using namespace std;
/*
*
* Prosen Ghosh
* American International University - Bangladesh (AIUB)
*
*/
int main() {
int h,m,s;
char c[2];
scanf("%d:%d:%d%s",&h,&m,&s,c);
if(!strcmp(c,"PM") && h != 12)h+=12;
if(!strcmp(c,"AM") && h == 12)h = 0;
printf("%02d:%02d:%02d\n",h,m,s);
return 0;
}
Also in C++:
- Title
- length of string c++
- Category
- C++
- Title
- c++ while true
- Category
- C++
- Title
- c++ char print width
- Category
- C++
- Title
- min heap priority queue c++
- Category
- C++
- Title
- c++ variable arguments
- Category
- C++
- Title
- never gonna give you up
- Category
- C++
- Title
- sort function in c++
- Category
- C++
- Title
- how to convert int to string c++
- Category
- C++
- Title
- c++ how to return an empty vector
- Category
- C++
- Title
- binary tree search
- Category
- C++
- Title
- varint index
- Category
- C++
- Title
- split string at index c++
- Category
- C++
- Title
- how to read a comma delimited file into an array c++
- Category
- C++
- Title
- primitive and non primitive data types in c++
- Category
- C++
- Title
- Temporary file using MSFT API in cpp
- Category
- C++
- Title
- Application of c++ in youtube program
- Category
- C++
- Title
- std string find character c++
- Category
- C++
- Title
- how to include seld declared header file in c++
- Category
- C++
- Title
- recursion in cpp with reference
- Category
- C++
- Title
- how to sort an array according to another array c++
- Category
- C++
- Title
- pair in c++
- Category
- C++
- Title
- transpose matrix eigen c++
- Category
- C++
- Title
- c++ replace substrings
- Category
- C++
- Title
- c++ string^ to char*
- Category
- C++
- Title
- powers of 2 in cpp
- Category
- C++
- Title
- lambda operator in c++
- Category
- C++
- Title
- c++ short if
- Category
- C++
- Title
- c++ read matttrix from text file
- Category
- C++
- Title
- convert char to string - c++
- Category
- C++
- Title
- c++ compare char
- Category
- C++
- Title
- variabili in c++
- Category
- C++
- Title
- for c++
- Category
- C++
- Title
- leveling system c++
- Category
- C++
- Title
- iterate const vector
- Category
- C++
- Title
- how to compare two strings lexicographically in c++
- Category
- C++
- Title
- pass vector by reference c++
- Category
- C++
- Title
- syntax c++
- Category
- C++
- Title
- c++ get type name of object
- Category
- C++
- Title
- clear file before writing c++
- Category
- C++
- Title
- free or delete in c++
- Category
- C++
- Title
- remove element by index from vector c++
- Category
- C++
- Title
- c++ string to stream
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- fast input output in c++
- Category
- C++
- Title
- best fit algorithm
- Category
- C++
- Title
- inverser les éléments d'un tableau manuellement en c++
- Category
- C++
- Title
- c++ initialize a vector
- Category
- C++
- Title
- get data from terminal c++
- Category
- C++
- Title
- c++ base 10 to base 2
- Category
- C++
- Title
- border radius layout android xml
- Category
- C++
- Title
- friend function in c++
- Category
- C++
- Title
- FInd the element which appears more than n/2 times C++
- Category
- C++
- Title
- how to delete something in an array c++
- Category
- C++
- Title
- how to allocate on heap in c++
- Category
- C++
- Title
- linear search in c++
- Category
- C++
- Title
- call by reference c++ example
- Category
- C++
- Title
- c++ comment
- Category
- C++
- Title
- file format not recognized treating as linker script c++
- Category
- C++
- Title
- what are the different ways to traverse a binary tree
- Category
- C++
- Title
- jump to case label c++
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- how to initialize a vector in c++
- Category
- C++
- Title
- how to delete a node c++
- Category
- C++
- Title
- c++ return multiple values
- Category
- C++
- Title
- system("pause") note working c++
- Category
- C++
- Title
- c++ remove text file
- Category
- C++
- Title
- double to string c++
- Category
- C++
- Title
- chess perft 5
- Category
- C++
- Title
- C++ w3schools
- Category
- C++
- Title
- least number of coins to form a sum
- Category
- C++
- Title
- error: invalid use of template-name without an argument list
- Category
- C++
- Title
- How to traverse in a tree iterative C++
- Category
- C++
- Title
- how to concatinate two strings in c++
- Category
- C++
- Title
- compare function in sort c++ stl
- Category
- C++
- Title
- convert int to binary string c++
- Category
- C++
- Title
- cout console
- Category
- C++
- Title
- capitalize first letter c++
- Category
- C++
- Title
- Check if a Number is Odd or Even using Bitwise Operators
- Category
- C++
- Title
- c++ for loops
- Category
- C++
- Title
- how to iterate through a map in c++
- Category
- C++
- Title
- time conversion hackerrank solution in c++
- Category
- C++
- Title
- map arduino
- Category
- C++
- Title
- ue4 c++ struct
- Category
- C++
- Title
- Given an undirected graph, count the number of connected components.
- Category
- C++
- Title
- c++ create array
- Category
- C++
- Title
- cpp pi from acos
- Category
- C++
- Title
- c++ max of array
- Category
- C++
- Title
- how to find length of string in c++
- Category
- C++
- Title
- c++ lettura file
- Category
- C++
- Title
- cube mapping sdl
- Category
- C++
- Title
- COnvert string to char * C++
- Category
- C++
- Title
- Runtime Error: Runtime ErrorBad memory access (SIGBUS)
- Category
- C++
- Title
- first fit algorithm
- Category
- C++
- Title
- heap in cpp stl
- Category
- C++
- Title
- how to get the prime number in c++ where time complexity is 0(log n)
- Category
- C++
- Title
- unordered_set in c++ and ordered set diff
- Category
- C++
- Title
- c++ char print align
- Category
- C++
- Title
- how to sort a vector in c++
- Category
- C++
- Title
- c++ not greater than
- Category
- C++
- Title
- c++ reset stream
- Category
- C++