by admin
Welcome -- read before posting!
Welcome to the beginner's forum in! In this forum, users can to talk about any topic related to C++ for non-expert audiences. Feel free to participate...
[2 replies] Last: How To Answer Questions in a Helpful Way Be gentle. Problem-relat... (by admin)
Console Closing Down (1,2,3,4,5,6,7)
Hi, i am new to C++ and have just written my "Hello World" program. It worked all right but the console/cmd closes down instantly. If you tell me why it is clos...
[120 replies] Last: It displayed "Hello world" after you pressed Enter. int c is a ... (by Duthomhas)
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 ...
[2 replies] Last: What are you trying to do? Do you try to find multiple locations? Sinc... (by coder777)
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...
[4 replies] Last: @seeplus i convert the expression using shunting-yard (by codinglexernewbie)
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...
[no replies]
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)
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() { ...
[5 replies] Last: Herb Sutter is someone who I listen to when he mentions something C++:... (by George P)
About character sets
I looped through 512 characters and I realized that: my character set is 256. so it is not an 7-bit ascii. Instead, it is variant. My question is: Is there a...
[2 replies] Last: my cygwin compiler still produces smiley faces for those. if its just... (by jonnin)
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 (by seeplus)
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>...
[5 replies] Last: No. I use a 3d-array for the board... (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)
Unexpected behavior 2!
Consider the code below: int total; std::cin >> total; int ary ; for(int i=0;i<total;i++) ary = i; for(int i=0;i<total;i++) std::cout...
[9 replies] Last: It's not as straightforward as it looks because it interferes with the... (by Peter87)
A linux for programming
I never used a linux OS, I am open to the idea of using it lately, what is the best linux for programming you advice? thanks
[18 replies] Last: Got it, thank you everyone) always honored. (by ninja01)
Work around for limitation of template virtual member functions?
Hi I have a Message class which other classes inherit from. The inherited classes will need to have a serialisation member function. I would like to make these...
[1 reply] : You could use some special-case code for each class, or exploit that T... (by mbozzi)
checking if the inputs are valid Palindrome
How can I make this program work to determine whether these 5 palindromes are valid or not? #include <iostream> #include <string> struct Result { int...
[6 replies] Last: thank you guys :) (by vonits23)
by dvdlly
building a multilayer perceptron
Hello, I want to implement a simple multilayer perceptron for digit recognition. I have started to read the c++ primer 5th edition book 2 days ago so I am no...
[9 replies] Last: @dvdlly, I am well aware that the code you provided is a header file, ... (by lastchance)
Pages: 123... 7
  Archived months: [jul2022]