Mustapha
Thanks bro
I got you
Anonymous
Can anyone help me how to use this "&" in time?and how to use that
Anonymous
Thank you
Anonymous
It takes password from user Password must include 1. Uppercase 2. Digit 3. Dollar sign
You might also want to invest time into learning regular expressions, in particular lookahead assertions. Lookahead assertions may be used to create logical AND between multiple regular expressions. #include <regex> const std::regex rgx = "(?=.*[[:upper:]])(?=.*[[:digit:]])(?=.*\\$).{,50}" ; if(!std::regex_match(password, rgx)) { \\ your logic here, for incorrect password \\ } Regular expressions, in any programming language that supports them, are a form of string pattern-matching that can seem challenging but are worth the time and effort spent learning them. https://en.cppreference.com/w/cpp/regex If the current C++ regular expression library does not meet your needs (there have been some concerns about it's performance, in terms of speed), there are several good libraries you can select from, one of which (CTRE) has proposed for inclusion in a future C++ standard. https://github.com/hanickadot/compile-time-regular-expressions
Anonymous
How can i reduce the lines number of this code?... I guess it could use less lines:
Ludovic 'Archivist'
Ludovic 'Archivist'
and always use infinite loops
Anonymous
Better code does less work with more lines of code
I'm trying to send the code here, but it takes too much size.
Ludovic 'Archivist'
or gist
Anonymous
use pastebin
Yes, thanks, i've used pastebin... This is the code: https://pastebin.com/u80JDxsw
Anonymous
I just want to know how reduce the lines.
Jagadeesh
#include<stdio.h> #include<stdlib.h> void main(){ struct emp{ int eno; char ename[20]; float esal; }; struct emp* ptr; ptr=(struct emp*)malloc(sizeof(struct emp)); if (ptr==NULL) printf("no memory"); else printf("enter the details:"); scanf("%d,%s,%f",&ptr->eno,ptr->ename,&ptr->esal); printf("%d,%s,%f",ptr->eno,ptr->ename,ptr->esal); }
KAZEEM
It's %lf instead
Jagadeesh
KAZEEM
It's %lf instead
I mean for the float data type
Anonymous
hello! anyone here who knows what is actual running time? is it the same as execution time or no? tia
Aloisio
What is the best book about STL programming?
Vishnu
Guys what is the best approach/ method and resources to master C/C++ for a beginner ??
Adarsh
More and more
Anonymous
for (int i = 0; i < n; i += 3)
Anonymous
More cleaner that way
Anonymous
hello! anyone here who knows what is actual running time? is it the same as execution time or no? tia
If you want to be pedantic, the running time is actually the time that your program is being executed by the CPU (ignoring other things like I/O, process being context switched and all). The execution time is the time from the start of the program till the time it ends. So if your process is blocked, it will add to the execution time but running time won't be affected. But people usually use the terms interchangeably and it is often used to mean the time the thr program takes from start to finish.
Anonymous
What is the best book about STL programming?
When you say STL programming, do you mean programming with the standard library?
Anonymous
Standard template library (STL)
Anonymous
Standard template library (STL)
The OP should clarify it. STL is not a term used anymore. It was the name given to the library that Stepanov designed. If it is the same that he is referring to then the term is Standard Library. The reason why I asked the question to the OP is to find out if he wants to learn about the library or template programming in general.
Anonymous
Oh 😅
Aloisio
Yes, Standard Library.
Anonymous
Yes, Standard Library.
C++ Standard Library by Nicolai Josuttis. Covers the C++11 standard library in detail. You can then lookup cppreference to find out the new additions in C++17 and C++20.
Aloisio
Thanks
Pavel
I need an elaborate answer , please
To get more precise answer you need to ask more precise question. First, there's no C/C++, you need to choose what you want to learn C or C++, they are very different in approaches. Second, there are books and tutorials. You can find links with lists of books here in this chat for C or for C++. #cppbookguide for C++ #cbook for C
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
#include <stdio.h> #include <stdlib.h> int main() { int number[10]; int sum = 0; int counter=1; int count =1; do{ printf("Enter number %d: ",count); scanf(" %d", &number[10]); sum+=number[10]; counter++; count++; } while(counter <=10); printf("\nSum Of Your Entered Numbers = %d.", sum); return 0; }
Anonymous
There is no index 10. I guess it's a typo and u meant to put a var there :)
Anonymous
Probably counter. And I would change 'count' to 'num' for readability.
Anonymous
Arguable
Oh u are right. count is fine. I missread it
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Yeah
I took them out and the code is acting up bro
Pavel
I took them out and the code is acting up bro
That's because you not reusing it, you just write your value into some memory outside of the array and then use it for the sum. You don't even need an array for that
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
What
After editing it out, the sum i get from the program is wrong
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Edit what out?
The 10 out
Anonymous
What did u put instead of 10?
Anonymous
Get rid of the count variable and use counter as the index
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
What did u put instead of 10?
Just “& number”
Anonymous
Just “& number”
Emm why? U need to refer to an int. Just replace the 10 with counter
Pavel
Kind of new to this Started learning C like 2 days ago so i don’t really get you
int number[10]; declares an array of 10 elements Then number[10] points to the 11th element from the array. Which is just some memory next to the array
Pavel
You are lucky it doesn't crash
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
You are lucky it doesn't crash
But it worked as expected Its what surprises me
Pavel
But it worked as expected Its what surprises me
It's because reading outside of bounds of an array is undefined behaviour https://en.m.wikipedia.org/wiki/Undefined_behavior
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
#include <stdio.h> #include <stdlib.h> int main() { int number; int sum = 0; int counter=1; do{ printf("Enter number %d: ",counter); scanf(" %d", &number); sum+=number; counter++; } while(counter <=10); printf("\nSum Of Your Entered Numbers = %d.", sum); return 0; }
Pavel
I think this is how you guys are describing it to be
Yes, from looking at it, it looks much more correct
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Golden Age Of
Mustapha
Okat let me run it tomorrow
Ka. LOVE |• kalhim ng ilaw • TSV: Lokal ng SUCAT
Hi gyys
Ka. LOVE |• kalhim ng ilaw • TSV: Lokal ng SUCAT
May i ask something?
Ka. LOVE |• kalhim ng ilaw • TSV: Lokal ng SUCAT
We have this activity the array one
Ka. LOVE |• kalhim ng ilaw • TSV: Lokal ng SUCAT
Two dimensional array
Ka. LOVE |• kalhim ng ilaw • TSV: Lokal ng SUCAT
In c++
Ka. LOVE |• kalhim ng ilaw • TSV: Lokal ng SUCAT
Anyone here knows how array works?🥺
Golden Age Of
Anyone here knows how array works?🥺
I guess someone from 15k should be done with it...
Anshul
Two dimensional array
You should refer some video lecture for 2d arrays. They're very useful