many
After endless repetitive orm pattern, I finally realized why people write in lisp
many
I should have known the existence of lisp earlier
Anonymous
Explain it
Anonymous
klimi
Anonymous
Aniket
Hello
Aniket
I'm new
klimi
Hello!
Anonymous
Gn
Anonymous
😴😴
Anonymous
Shwe
Hi
Shubham
Hii
Anonymous
Hi
kr4T0X
kr4T0X
Check this... I'm having kind of logical error or is there something else?
Anonymous
Anonymous
And the code should be pasted via paste services, no files
Mohd
Is
9.36-12
a valid real constant???
in C language
Anonymous
Anonymous
Anonymous
And what do you mean by "valid real constant"?
kr4T0X
kr4T0X
Anonymous
kr4T0X
Wait
kr4T0X
#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
char F, S, T, Fo;
printf(" Hello :) \n");
printf("Q1 \n");
scanf("%c", &F);
if(F=='y')
{
printf("R1 \n");
printf("Q2 \n");
scanf("%c", &S);
if(S=='y')
{
printf("R2 \n");
printf("Q3 \n");
scanf("%c", &T);
if(T=='y')
{
printf("R3 \n");
printf("Q4 \n");
scanf("%c", &Fo);
if(Fo=='y')
printf("R4 \n");
else
{
if(Fo=='n')
printf("R44 \n");
else
printf("A4 \n");
}
}
else
{
if(T=='n')
printf("R33 \n");
else
printf("A3 \n");
}
}
else
{
if(S=='n')
printf("R22 \n");
else
printf("A2 \n");
}
}
else
{
if(F=='n')
printf("R11 \n");
else
printf("A1 \n");
}
getch();
return 0;
}
kr4T0X
Like this?
Dima
WHAT
Dima
who the hell teaches you to name variables like that!
kr4T0X
It's just an hierarchy, not the real code.😑
Anonymous
kr4T0X
Sorry, for bad english. Let me check the rules.
kr4T0X
Again!
Dima
It’s not about the English, just don’t post your raw large code snippets like that, use pastebin/hastebin etc..
kr4T0X
Oh, okay!
I'm sorry.🙁
kr4T0X
I'll.
Anonymous
for(int i=0;i<a.length()-2;++i){
ans = max(ans,r[i+1] - l[i]-1);
}
Anonymous
Here, a is a string
Anonymous
the length of a is 1
Anonymous
But during debugging, I found that the loop was getting executed twice or thrice
Anonymous
The I did this:
int x = a.length();
for(int i=0;i<x-2;++i){
ans = max(ans,r[i+1] - l[i]-1);
}
Anonymous
And suddenly it worked well
Anonymous
The loop didn't execute at all which should have happened.
Anonymous
Is writing
for(int i=0;i<a.length()-2;++i)
BAD in c++
?
Anonymous
Anonymous
Modern means C++11 ot newer
Anonymous
Anonymous
I_Interface
Anonymous
The right way in modern C++ is using range-based for
Anonymous
I_Interface
Ye, as Danya said: range based loops and auto for vars, that's is modern cpp
Anonymous
for example:
std::string str = "...";
for (auto ch : str}
f(ch)
I_Interface
auto& is better :3
Anonymous
Anonymous
Anonymous
It depends
Well you don't want to make copy everytime. but, yes it depends
I_Interface
or const auto& if u won't change it
Anonymous
Anonymous
I_Interface
And yes, not all collections have index operator
I_Interface
Anonymous
Isn't it?
Anonymous
It's only you thinking so