100$ website
you cant make it infinite, but you can restructure this so it looks nicer
what can be limit of numbers if i cant make it infinite? i will learn to restructure it and make code look nicer
100$ website
also i havent learned pointers yets and libraries itoa
coal
you cant make it infinite, but you can restructure this so it looks nicer
make a map where you parse an integer value to a string name #include <map> #include <string> int main() { std::map<int, std::string> units = { {1, "one"}, {2, "two"}, {3, "three"}, {4, "four"}, {5, "five"}, {6, "six"}, {7, "seven"}, {8, "eight"}, {9, "nine"}, {10, "ten"}, {11, "eleven"}, {12, "twelve"}, {13, "thir"} {14, "four"} {15, "fif"} {16, "six"} {17, "seven"} {18, "eigh"} {19, "nine"} {20, "twenty"}, {30, "thirty"}, {40, "forty"}, . . . }; }
coal
then you can parse every digit in the number and combine values of the map to create a string
coal
for example, units[40] + " " + units[8] is "forty eight"
coal
you just need to engineer the way to know which ones to combine
coal
the first 19 values will be the hardest ones as english is quite inconsistent there
coal
but it becomes repetitive after twenty
what can be limit of numbers if i cant make it infinite? i will learn to restructure it and make code look nicer
you may want to take a look at this: https://stackoverflow.com/questions/40252753/c-converting-number-to-words
coal
wow thank you : )
the stackoverflow page that sent here is useful as well, check it out
sasha
Hello, what means "&&" after a type? Like this std::string&& f_name
coal
usually used to perform perfect forwarding
sasha
thx
Anonymous
How can I be good at C programming
Anonymous
.
https://www.chegg.com/homework-help/questions-and-answers/create-program-asks-8-true-false-questions-store-correct-answers-bits-8-bit-number-go-trou-q44403754 please help with the solution without using bitset, I have tried but cant figure out how to know if question in array is asked using 8 bit integer 🥲
Anonymous
Same question 🥺
Learn, implement and teach others what u learnt...
Anonymous
Learn, implement and teach others what u learnt...
I want to learn from staring Understand that I don't know anything about this, I don't know anything. so what should i do?
Anonymous
reference to reference (rvalue reference)
That is wrong. && is an rvalue reference which is not a reference to a reference. C++ doesn't allow references to references because references are not objects but aliases. References to references can inadvertently be created through template programming or through typedefs and using aliases, but the reference collapsing rules account for it and convert such cases to either a lvalue reference or an rvalue reference. A rvalue reference is just a new type of reference introduced in C++11 that can be used to refer to rvalues (xvalues with a cast through std::move or std::forward or a prvalue).
Anonymous
usually used to perform perfect forwarding
This is also wrong. Rvalue references are not used for perfect forwarding. There is another kind of reference called a forward reference (or universal reference as coined by Scott Meyers'). These references are what are used for perfect forwarding. A reference of this kind is created when you have template function with T as a template parameter and the function has an argument of type T&&. Here T&& is not an rvalue reference but a forwarding reference.
Mo
Guys if you know some chanel on YouTube or a course in the internet that teaches you how to use C in web dev, Please tell me thanks
coal
thanks for your insights
Coffee
Hello guys,does anyone know about the fuse framework in linux? About the functions in /usr/include/fuse/fuse.h, does anyone know how to implement them? I haven't found any documentation about those function parameters on the Internet, do I still need to know Any other knowledge?
Anonymous
#include <stdio.h> struct kims { char title[50]; int year; float cost; }; int main() { struct kims Book1=["C Programming",2021,127]; printf("book title is %s\n",Book1.title); printf("year of publication is %d\n",Book1.year); printf("cost is %.2f\n",Book1.cost); return 0; } What is wrong with this codes
Coffee
struct kims Book1=["C Programming",2021,127]; -> struct kims Book1={"C Programming",2021,127};
Coffee
structure initialization needs to use {} instead of []
Anonymous
Thanks it worked
Anonymous
#include <stdio.h> int global; int main() { int local1=5; int local2=10; glodal=local1+local2; printf("%d\n",global); return 0; } { int local3=2,local4=3; global=local3+local4; printf("%d"global); return 0; } This one too has an error
Erica
Try checking out
Anonymous
Artur
Any suggestions for good c++ 20 book for advanced/experts? For improving ?
John
How can I be good at C programming
try with basics on sites like sololearn, programmiz, tutorial point then try simple projects later complex in ones, don't forget to read source codes of various projects on GitHub
mito
Three variables next to each other in memory. 0040141e c7 44 24 MOV dword ptr [ESP + a],0x73736170 38 70 61 73 73 00401426 c7 44 24 MOV dword ptr [ESP + b],0x64726f77 3c 77 6f 72 64 0040142e c7 44 24 MOV dword ptr [ESP + c],0x333231 40 31 32 33 00 —————————————————————————- undefined4 a; undefined4 b; undefined4 c; Values in a,b,c with their ASCII char respectively: a = 0x73736170; //"ssap" b = 0x64726f77; //"drow" c = 0x333231; //"321" char pass [30]; // any string. So, if I do, strcmp((char *)&a,pass); Will "a" take everything in the memory as a string until it reaches "\0" ? 0040142e c7 44 24 MOV dword ptr [ESP + c],0x333231 40 31 32 33 00 Since there's 00 after 33 in the memory at this address.
mito
english
Null
english
That's nonsense...
\Device\NUL
c = 0x333231; //"321" This already contains a NUL char. 0x333231 is equivalent to 0x00333231. As per the mov is dword, hence 4 bytes. mov dword ptr [ESP + c],0x333231 is the same with: mov dword ptr [ESP + c],0x00333231 As such, the bytes representation is "321\0".
\Device\NUL
Recall that x86 follows little endian byte order.
-
Hello guys. Could you help me with the code please? I believe that everything is ok here, but I get "Segmentation fault core dumped"
-
This link contains my code
Anonymous
-
#include <stdio.h> /* working with arrays*/ int main(){ float number; //the element of an array int length; //the size of an array float arrayOfNumbers[length]; //an array which has {length} elements printf("Please length: "); scanf("%d",&length); int i=0; //index while (i<length){ printf("Please your number for index %d: ", i); scanf("%f",&number); arrayOfNumbers[i]=number; i++; } float sum = 0; //sum of all elements for(int j=0;j<length;j++){ sum = sum + arrayOfNumbers[j]; } float average; //average of all elements average = sum/length; printf("The average is %.2f\n", average); //the value of an average will have 2 digits after the decimal point float max=arrayOfNumbers[0]; float min=arrayOfNumbers[0]; //the maximum and the minimum values of an array for(int k=1;k<length;k++){ if (arrayOfNumbers[k]>max){ max = arrayOfNumbers[k]; } else if (arrayOfNumbers[k]<min){ min = arrayOfNumbers[k]; } } printf("Maximum number: %f \nMinimum number: %f \n", max, min); return 0; }
Laopigo
This link contains my code
https://pastebin.com
-
The problem starts after this line
-
You're declaring the array before length has a value. Input the length first, then declare
@ankit1w but if I delete everything after this line it will work even if I don't change what you said
-
What's the reason?
Anonymous
@ankit1w but if I delete everything after this line it will work even if I don't change what you said
It's unpredictable behavior. On some system, it might run without any errors at all. In some system, might fail early on. Compile with the -Wall flag to see warnings. Under optimal conditions, your code shouldn't have any warnings.
Anonymous
-Wall flag? What's that?
What IDE do you use?
Anonymous
Vs code
Press Ctrl+shift+P, then send the contents of settings.json
-
I didn't get it
Anonymous
I didn't get it
Press ctrl+shift+P, search settings.json, open the file and send the contents here
Artur
Can anyone suggest a good integration test framework for c++ project something like rspec but framework needs to be either c++ or python, guys how do you do your integration tests ?
Daniel
Hello guys, how are you? Can someone help me?
Prometheus
Daniel
It's very simple, I am sure. But I am very jr yet
Daniel
What’s your question?
so, i am trying change this comparison if(memcmp(data, &chunk[i], len) == 0)
Daniel
to a comparison with float values. this above work but only for string/char values
Daniel
i am scanning a process memory, trying find the value 0.12048
Daniel
but, memcmp does not work with float values, and data == $chunk[i] not as well
Daniel
the point: how make the comparison but with float value
Prometheus
i am scanning a process memory, trying find the value 0.12048
Could try converting the float to a string