-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtips
30 lines (22 loc) · 1.38 KB
/
tips
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use int till 10^9
------------------------------------------------------------------------------------------------------------------------------
//print upto 3 decimal places
cout<<setprecision(3)<<fixed<<a<<endl; //#include <iomanip>
cout<<round(b*1000/n)/1000<<endl;
------------------------------------------------------------------------------------------------------------------------------
//read string as input
char str[100000];
scanf("%s",str);
for(t=0;str[t]!='\0';t++); // t = length of string
------------------------------------------------------------------------------------------------------------------------------
//read string till ':' delimiter by avoiding space
getline(cin,h,':');
------------------------------------------------------------------------------------------------------------------------------
// string to number
int a=s[i]-'0';
string s="";
s+= digit+'0';
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------