Beginners - September 2022

trying to build a basic linear algebra library
 
I am trying to implement a function to generate a Matrix as it is defined in my Matrix.h file initialized with random values drawn from a gaussian distribution....
[3 replies] Last: @seeplus thanks I didnt see that as usual... @JLBorges maybe - I am 3... (by closed account E093605o)
About conio.h
 
I know that conio.h is not c++ standard library nor a c standard library. Do you know any information about the library like where it comes from and why it i...
[16 replies] Last: I am still using the conio.h, and I guess it is considered a third pa... (by seeplus)
trying to build a basic linear algebra library
 
I am trying to learn C++ and want to build a Matrix library. So far I have a Matrix.h file: //Matrix.h #pragma once #include <vector> template<typena...
[13 replies] Last: also try to find the first error that relates to your code. You might ... (by seeplus)
About ASCII extended code
 
I just found two different ASCII code table, I am asking the following: 1: How many ASCII extended table are there? 2: Where can I find them? Thanks)
[11 replies] Last: This is my output in both cmd with @seeplus command and my code to out... (by ninja01)
C-array as function parameter
 
Hi everyone! I am learning about the subtleties of C-arrays (yes, I know one should use vectors instead, but one still needs to understand classical arrays wh...
[11 replies] Last: Yeah - my bad. std::span always works with std::array (by seeplus)
Is saying: compiling a program practically wrong?
 
I think when we say compiling a program, we include implicitly preprocessing it, which is not a compilation of a program text, am I right or wrong?
[17 replies] Last: Thanks @Duthomhas (by ninja01)
How to make sudoku16x16 as fast as possible
 
Good day , I need assistance in making my sudoku as fast as possible currently it completes it in 1163 seconds #include <iostream> #include <algorithm>...
[7 replies] Last: Yes - I used a variation of that algorithm. Rather than using a bitset... (by seeplus)
I want to only compile not compile and link
 
With writing this: g++ file.cpp -o file.exe I found myself with an .exe, and I assume that this is compilation+linkage. 1: Am I wrong/right on this one? 2:...
[9 replies] Last: Thank you @George (by ninja01)
Question 5 about optimization
 
Probably the last optimization question and it is about initialization Part I Consider the two snippet below: int main() { int nbr; } int main() { ...
[13 replies] Last: Also note that classes that have a default constructor will initialise... (by seeplus)
how do i implement a for loop in a math interpreter
 
how do I implement loops in a math interpreter? it gets the tokens but discards them after reading them but I want to implement for loops and such, like > Σ(n...
[5 replies] Last: You may find this useful. https://github.com/ArashPartow/exprtk (by kbw)
Trying to compile multiple files
 
Consider those files: main.cpp # include "file.h" # include <iostream> using namespace std; int main() { func(); cin.get(); retu...
[2 replies] Last: Thank you @salem (by ninja01)
search for words in a file
 
Hi, I have a program I'm currently working on where I'm trying to read a particular city from a file. Here is the content of the file below: Oakland : Lake ...
[5 replies] Last: Trim a string: https://cplusplus.com/faq/sequences/strings/trim/ (by Duthomhas)
JSON C++
 
Using Visual C++ 2022 community edition to compile following JSON C++ program from book C++20 for Programmers by Deitel & Deitel, Published in 2022, chapter 9 p...
[9 replies] Last: Hello Seeplus: Many, many thanks for fixing the program by correct... (by AlexCantor)
Why const int instead of just int
 
const int func(void) { return 3; } In code above, what is the need of const int as returned type instead of just int? Can you site a specific situ...
[5 replies] Last: A series about using const, starting with const local variables. https... (by George P)
Some sort of hack?
 
Can I check wether my operation system is 32/64 using the code below: switch(sizeof(int*)) { case 8: std::cout << "64-bit system" << std::endl; ...
[16 replies] Last: There are lots of web-pages with "simple code" on the internet that al... (by George P)
Question 3 about optimization
 
which one is better: for(int i=0;i<(int)strlen(bTitle);i++) or int titleLength = (int)strlen(bTitle); for(int i=0;i<titleLength;i++) I think ...
[7 replies] Last: If you change the size of a c-style string within the loop, then you'l... (by seeplus)
Question 1 about optimization
 
is there any way to test which of two algorithm is best in terms of speed/efficiency and number of instruction? Note: I am about to flood this forum with cou...
[10 replies] Last: See how timings were done in this thread https://cplusplus.com/forum/b... (by seeplus)
Question 4 about optimization
 
Consider the two code snippet below: int side ,s ,p; cout << "Enter square's side value -> " << endl ;cin >> side; s = side*side ; p = side*4 ; cout <...
[15 replies] Last: Yeah - but that was then and this is now as they say. I used to do in-... (by seeplus)
Question 2 about optimization
 
which one is better a>=6; or a>7 I think the a>=6 does two operations while a>7 does only one, so the second one is better. Am I wrong here?
[6 replies] Last: integer comparisons at assembler level tend to be based on a test inst... (by seeplus)
pointer to char related
 
Consider code below: int i = 3; int *pi = &i; double d = 5.2; double *pd = &d; char c = 'j'; char *pc = &c; cout << pi << endl; cout << pd <<...
[2 replies] Last: Thank you very much @Ganado) (by ninja01)
September 2022 Pages: 1234
  Archived months: [aug2022] [oct2022]

This is an archived page. To post a new message, go to the current page.