Beginners - April 2021 (Page 8)

int and double help?
 
Trying to print out the "totalVotes" as an int and the "votePerc" as a double. My issue is if I keep their types seperate the "votePerc" calculation comes out t...
[1 reply] : for(int i = 0; i < ARRAY_SIZE; i++) { votePerc = (tab... (by Ganado)
by Horror
changeing each lowercase letter to uppercase
 
I have to write a program that reads strings of text from a datafile called “data.txt”, changes each lowercase letter to uppercase, and places each letter b...
[3 replies] Last: Using a queue and a stack to test that a word is a palindrome is far m... (by seeplus)
Can you #define values for a header in another file?
 
EDIT : Sorry for the confusion. Let me rephrase what I meant to ask: Given the code below, where should I put the #define DEBUG_ENABLE 1 so that I can togg...
[5 replies] Last: You normally want to set those kinds of configuration macros in the co... (by helios)
Write to Serial Port
 
Greetings! I am still learning the overall structure of C++, plus I am at a point where in order to maintain my interest in it, I need some help over a hurdl...
[4 replies] Last: @Nico I don't see anything in your try block that would throw exceptio... (by mbozzi)
How to fix "expression must have integral or unscoped enum type"
 
I have the following code and trying to perform a simple calculation: #include <cmath> #include <math.h> #include "fftw3.h" using namespace std; int mai...
[7 replies] Last: I was under the impression that I can use memset as an initialization... (by Ganado)
Operator not declared in this scope
 
Hey, I have been trying to compile a source file in OpenFOAM which uses the C++ syntax. When I run try to compile the make file I get the error 'autoCreateK' wa...
[3 replies] Last: Hey, thanks for that. (by Thugfreak)
std::min function help
 
I have a simple question really I am trying to find the minimum between two values and use it as a new value in a function. For example, in my code I am star...
[8 replies] Last: @lastchance If D is diffusivity in your code, what is k? Normally suc... (by JamieAl)
Stack
 
The question is : "Make a program for creating of Stack S, after this to set N-th from the bottom element of S with values A, exclude from stack first N-1 from ...
[12 replies] Last: but, its not a hard coded problem, that is just the example. someth... (by jonnin)
I cannot change octal to binary
 
Seems like octalToBinary function has some problems. Could you please tell we how to fix? #include<iostream> #include<cmath> using namespace std; ...
[2 replies] Last: You can't pass an octal 'number' as an int. int (and its variations) a... (by seeplus)
How to detect key enters?
 
Hi guys! I want to make my program clear the screen once I pressed a specified key. How can I do that? The following is my idea of code but I don't know whethe...
[6 replies] Last: [quote=seeplus]For Windows, Virtual terminal codes are only supported ... (by mbozzi)
by y19177
assert statement is not working
 
Practicing template class. This is a generic array class, but I'm not sure why the program does not terminate when I try to call "list = 's'; ". Thanks in adva...
[2 replies] Last: @lastchance Thanks for pointing out my mistakes, I think it is all s... (by y19177)
by L67GS
Julius API
 
Does anyone have experience with Julius Speech recognition under Linux in C++? I've found API stuff and it's honestly way over my head so I'm hoping someone cou...
[no replies]
by siid14
ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
 
I got a warning as you can read from the title. Precisely this is this line that is affected : Rectangle(double, double, char *); ...
[4 replies] Last: you can ugly it up and do it with S. void foo(const char * cp) { ... (by jonnin)
moving array values
 
Coding arrays, one even, odd and then one merged for smallest value to larges. Only on even so far and when I input 4 then 2 it just prints 2. Can someone pleas...
[5 replies] Last: Thanks everyone for the help. (by phazed99)
function not printing result in menu program
 
Program is meant to allow the user to make several menu choices and print a total once they're done. Discount price is applied for items in multiple of two thus...
[6 replies] Last: The function prototype on L13 doesn't match the function definition on... (by seeplus)
how to create constructor for object containing array of other objects
 
I have tried many ways, but it seems that problem is in the string part, because I am always getting error core dumped segmentation fault. header file: s...
[6 replies] Last: It works!!! Thank you so much, I appreciate your help. (by petrmsofuse)
Function not returning correct value
 
I have a structure containing string, int and double. My function takes four doubles and compares it to the double from structure. But it's returning wrong valu...
[4 replies] Last: Thank you very much! (by petrmsofuse)
What does each Const in a member function defintion mean
 
First in C we have const int my_func() {return 0;}; This Tells the compiler that all calls to my_func() will return the same value In C++ we have: ...
[3 replies] Last: It's mainly a correctness feature. If a class instantiated variable is... (by seeplus)
by vysero
Decimals for numeric keypad
 
Hey guys. I am working on a numeric keypad which needs to handle decimal values. I am having some trouble handling decimal values in the range: [-1, 0, 1]. It w...
[4 replies] Last: Hello vysero, You could also try this: #include <iostream> #include... (by Handy Andy)
Table of symbols
 
Hey, I am trying to figure out how to print out a table of symbols into the console. I have an input file that has a predefined form such as this int main...
[2 replies] Last: L8 - 10 and L15 - 19. It would be far easier to store the required str... (by seeplus)
April 2021 Pages: 1... 678910... 12
  Archived months: [mar2021] [may2021]

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