Salwa
Hi i want to ask something. I make a change on my code, but when i run, the compiler seems to compile the code before the change. I tried several time but it still show the same output. How can i solve this? I already try to uninstalled and install the program.
Salwa
Already done it but still with the same output
Shahrukh
Already done it but still with the same output
Run your code on any online compiler
Pavel
Hi i want to ask something. I make a change on my code, but when i run, the compiler seems to compile the code before the change. I tried several time but it still show the same output. How can i solve this? I already try to uninstalled and install the program.
It can be an issue of IDE that you're using, that it fails to detect the change. I would google the problem mentioning the IDE Or you running compilation from the console?
AmR
I need some help with cmake, Can I asking about it >?
Anonymous
really??😱😳
AmR
@Chinepun Here ?
AmR
@Chinepun I need some help to use SOCI project, I want add some sqlite3 lib to be build 1st and then config soci to use that local lib, I want use that as https://github.com/utelle/SQLite3MultipleCiphers lib, I think in it like this I will write cmake script sqlite3 and add some how to export it's namespace as SQLITE3 and then before include soci I add that lib in main cmake script to let SOCI lib use it as dependencies, But The Q how to that ?
AmR
@Chinepun yes
Chinepun💛
You will have to write one yourself and if you need help, them we can help you out
AmR
@then How I can make cmake see my sqlite3 lib as the lib it willl use
Chinepun💛
Start a YouTube tutorial on how to write Cmake script
Chinepun💛
If you understand the structure of C++ files, it should not be a problem
AmR
@Chinepun I know some CMake, And Write my Main one
Chinepun💛
Then what problem do you have?
AmR
@Chinepun I need to tell cmake to use my local sqlite3 lib not one that in the system
Chinepun💛
AmR
yes
AmR
My project like that cmake -> mainApp -> soci
AmR
not that sorry
AmR
@Chinepun 1 : cmake -> 2 : mainApp -> 3 : soci -> 4: use sqlite3 from system -> 5 : local sqlite3 lib . I want override steep number 4 from outside soci in main cmake script by number 5
Serkan
Does pasting service is allowed, or not ?
Andre
Hi. I need to write a custom string generator with some skipping rules from charset. I googled a little and found this one "geeksforgeeks org/ generate-all-possible-combinations-of-at-most-x-characters-from-a-given-array/" It's good for a small total length and small charset length, but sucks with a big ones. Huge memory usage. Please, point me out, how should I optimize this algo? I found a swap algo, but it swaps chars with provided length in line, not custom total string length. Maybe I can modify it somehow? I use std::ofstream to save in file (not every line), but I still has all the array in memory. Also, I noticed, that this loop "// Traverse all possible lengths" (link above) generate all combinations from the beginning. For example, if I need 6 chars length, it will also generate 1-5 combinations.
Serkan
Okey, I did not want it to share as directly here but it seems there is on way around. I use VS Code to code C (I am new to C) Which line I should change in order to compile multiple c code at the same time. // tasks.json in VS Code { "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: gcc.exe build active file", "command": "C:\\MinGW\\bin\\gcc.exe", "args": [ "-fdiagnostics-color=always", "-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": "build", "detail": "compiler: C:\\MinGW\\bin\\gcc.exe" } ] }
Nomid Íkorni-Sciurus
Hi, I have a threaded libcairo win32 surface: HDC hdc = GetDC(vt->hwnd); vt->canvas = cairo_win32_surface_create_with_dib( CAIRO_FORMAT_RGBA128F, vt->width, vt->height ); for (;;) { draw(vt); BitBlt( hdc, 0, 0, vt->width, vt->height, cairo_win32_surface_get_dc(vt->canvas), 0, 0, SRCCOPY ); Sleep(delay); } For some reason, cairo_win32_surface_get_dc() is throwing access violation. This doesn't happen everywhere else, so I'm guessing it has to do with its internal dib object. What would you suggest me to do?
klimi
So you want C++ compiler code? if you are just hoping that someone will magically hang you the c++ represantition of that program i would say you are really mistaken. Please solve assigments on your own
redfox
#include<iostream> using namespace std; class Base { public: virtual void display() { cout<<"I am a Base Class"<<endl; } }; class Derived: public Base{ public: void display(){ cout<<"I am a Derived Class \n"; } }; int main(){ Base *p = new Derived; p->display(); // Envoked suring runtime return 0; } hi i have started learning polymorphism and as i was reading some programs trying to understand how it works when i came across 3 main things that i wasn't able to understand in the code i was reading 1) in the class Derived: public Base why are there " : " and a " public Base " i do not get why it was written that way 2)in the Base *p = new Derived what is "new derived" mostly what is new i get it that he is making a pointer but why " new " 3) lastly p->display(); what is the " -> " for i think it has something to do whit function overloading or virtual functions.
AmR
Can any one help me with cmake override find_package ?
smene
Hi everyone, which http client would you suggest to use in cpp?
j. c o l e
Who can solve my problem for money?
Prometheus
Figured that would be a good tidbit to add lol
Prometheus
j. c o l e
#include<iostream> using namespace std; class Test { public: int num, square, cube; void input() { cout << "Enter a number:"; cin >> num; } void findSquare() { square = num * num; } void findCube() { cube = num * num * num; } void display() { cout << "Square is:" << square; cout << "\nCube is:" << cube; } }; int main() { Test obj; obj.input(); obj.findSquare(); obj.findCube(); obj.display(); return 0; }
j. c o l e
this is code
j. c o l e
i want to make cycle to repeat the program 10 times
Leovan
j. c o l e
program can't run 10 digits
Prometheus
But i wrote about inheritance
This is what I get for using telegram half asleep. 100% misread that
Prometheus
program can't run 10 digits
What do you mean by it can’t run 10 digits? Also, are you required to use “using namespace std;”. Bad practice in the long run.
j. c o l e
What do you mean by it can’t run 10 digits? Also, are you required to use “using namespace std;”. Bad practice in the long run.
when you enter numbers like this: 1 5 4 8 9 6 7 5 2 6 program must output squares and cubes for all of them
Prometheus
So the user enters all of them one at a time and then it’s processed?
j. c o l e
yes
j. c o l e
i cannot receive squares for all of them
j. c o l e
program gives me only for the first number
Prometheus
So have the user enter them into an array. Int numbers[9], count = 0; While (count != 9) { cin >> numbers[count]; count++; } count = 0; While(count != 9) { //just run all math inside here using numbers[count] instead of num count++; }
Prometheus
There’s better ways to do it but when I was in college this would’ve sufficed. Waiting on my coffee to finish so there may be some mistype in there or something.
Anonymous
Exercise 1 - Hypotenuse of right triangles Calculate the Hypotenuse of n right triangles. Find and show the biggest hypotenuse. Input specification: You will be first given an integer (n), then in the following n lines you will be given two integers. The lengths of two sides of the triangles where n is between 0 and 2000. And sides are integers between 1 and 20,000.(sqrt is a function to calculate the square root of a number. For example, sqrt(9)3.0.Or,if num is 100,sqrt(num)gives 10). Output specification: Show a floating point number with two-digits precision: the length of the biggest hypotenuse. Solve the exercise using these functions: float hypotenuse(int a, int b); float compare_hypotenuse(float h, float max); float getData_ShowResult(int n);
Anonymous
anyone has done this before?
coal
no i dont think i have done your homework before
Sarmat
Hi guys, do you have some tutorials/articles about creating a messanger with c++ backend and frontend (desktop application) or maybe smth like that.
Krishnaa
#include<bits/stdc++.h> using namespace std; class stk{ private: int i=-1; public: int size, a[size]; stk(int n){ size=n; } int sizeOfStk(){ return size; } }; int main(){ int n; cin>>n; stk s(n); cout<<" stack size: "<<s.sizeOfStk(); return 0; }
\Device\NUL
Someone tell me why can't I print the stack size, here in my code??????
You declared variable length array with unitiliazed variable
\Device\NUL
Yet, please use pedantic on your compiler's flag, VLA is not in standard C++
\Device\NUL
https://www.quora.com/Is-it-good-practice-to-use-include-bits-stdc++-h-in-programming-contests-instead-of-listing-a-lot-of-includes
Krishnaa
Yeah thanks for the help
Krishnaa
I'll check this
Krishnaa
You declared variable length array with unitiliazed variable
Can u please correct the above code for me?
\Device\NUL
Can u please correct the above code for me?
The compiler message should be enough to know the mistake
\Device\NUL
Just read the message
Krishnaa
Ok bro thanks anyway.
Anonymous
How to start development in c++
Anonymous
Development: desktop application software
r3tr0m
https://pastebin.com/fR5P648K
Saad
Yess I read it and I’m agree with
Anonymous
hey, is there anyone who know javascript international group?
Parra
Hi everyone, I've created a new channel related to C/C++ advanced topics, feel free to join (thanks to the admins for letting me post it): https://t.me/programming_deadlock
?
> why can't the compiler figure out the data type of a "variable declaration" auto data type exist in C++ I don't like let the compiler choose own data type. With having access to variable data types we can optimize it for size and speed. Let's take an example, memory holds value and they're literally integers. There's no different with char, short int, int, long int', `long long int beside their sizes. p = 32; You want to use p again to hold another integer that larger than before but the compiler had automatically set its type to char . What would happen if p used to hold larger integer ? An integer overflow will happen. Size problem It shouldn't matter if you have large memory but it's matter if you work under low memory. auto p = 255 printf("%zu\n", p) The size of p is 4 bytes, but actually we can reduce its size into 1 bytes by changing it into unsigned char . Another thing, when you declare a data, you need to choose size or performance. For example in 64 bits machine int is 32 bit but int_fast32_t is 64 bit typedef long int. (I forgot where i readed it) Processor bits data size is the fastest data type
@kawaiighost first lemme say sorry for replying your message back very late. you don't like the compiler having control over what the type of data is ? well why you consider the solution to your problem is always "statically typed languages" why not "dynamically typed languages" ? you can exactly tell the compiler what the type of data is using the literal used in initializing a variable(even though compiler implementers and the C committee doesn't like doing it that way) 10 // integer initializer and type specifier 4 bytes 'c' // character initializer and type specifier 1 byte p='c'; // the variable "p" is initialized to a character(not only 'c' is a character initializer but is also a "type specifier" like "char" in C/C++ with the use of literals you can have control over the size of data perfectly like you do in a "statically typed language" and can optimize the size of your program too. i need to know how with statically typed languages you can optimize a program for speed ?? how can the size of data help with making the end executable program faster ?? > You want to use "p" again to hold another integer that larger than before but the compiler had automatically set it's type to "char". What would happen if "p" used to hold larger integer ? An integer overflow will happen. well C/C++ work's the same way you described in the above part of your message we can't put into a 1 byte long container the contents of a 4 byte long container. int i=57; char c=i; the above snippet is an example well the one very odd thing i see in designing the languge like i wish is that when re assigning a value again to a variable(through a character or integer literal) i will in the same time be specifying the type of the variable too. because the literal is meant to be a type specifier as well as an initializer. > Size problem yay thanks for pointing this one out. i completely agree with you on that. with the literal way of specifying types of variables we will not be able to optimize the size of the program the way we intend to because we will not have the help of "type qualifiers". THANKS FOR THE GREAT INFORMATION BUDDY CHEERS.
?
The benefits of a static typed language over a dynamically typed language is safety and speed. A static typed language knows the data types of all variables and can accordingly optimize access to it. As a simple example consider data types in PHP or even Python. When a variable is encountered, Python can't immediately start processing it. It uses an indirect mechanism like a pointer to some other structure which tell it what the data type of that object currently is and only then starts processing it. All these add up and make the language slower than statically typed language. To understand this more just search Google for "why numpy is faster than python lists".
@SilhouetteInDark sorry for late responses i was doing some research on this. in both language's there's some point where the "type" is "known" of data in both dynamically typed languages and statically typed languages. how can statically typed languages contribute speed to the end binary program ? why can't dynamically typed languages optimize the end binary program ? and like said maybe it be dynamic or static "it's all about knowing the type" and why can't dynamically typed languages be faster like statically typed languages and talking about "security" i need to know what we need the "security" for ? what are we/the compiler trying to secure with the help of a static type system why a dynamically typed language can't help with "security". and where can i do more research on this to fully understand this all. any good authoritative sources ? in the last part of your messages you wrote "why numpy is faster than python lists" i believe you are talking about the numpy library ? if so how is a library related to the type system of a programming language ?
Arta
Hi How good is C++ for backend programming? Definitely always has something to say But can it replace languages like php? I know the answer is probably no I have no experience in backend programming but I'm curious to know about c++ performance, how problematic are c++ security vulnerabilities?
klimi
Hi How good is C++ for backend programming? Definitely always has something to say But can it replace languages like php? I know the answer is probably no I have no experience in backend programming but I'm curious to know about c++ performance, how problematic are c++ security vulnerabilities?
idk if it is the best, but you can for sure use it. Wel... ofc it could be used as php... c++ performance? well... you are working pretty close to the hardware and i don't know what c++ security vulnerabilities... so idk