Questions tagged [c++]
The c++ tag has no usage guidance.
17
questions
0
votes
1
answer
15
views
I finally got my code to work but now I can't submit it can anyone tell why?
tps://i.sstatic.net/SvfAI.png
0
votes
1
answer
15
views
What is the purpose of & in c++?
I have this program that I am trying to understand, what does the & mean and what is it's purpose?
void fun(int &a, float &b);
0
votes
1
answer
21
views
What is the purpose of subtracting 1 while inside a increment? [closed]
I am confused about the code below
++counts[number-1];
What is the purpose of subtracting 1 in this code?
The entire code:
#include <iostream>
#include <iomanip>
#include <ctime>
#...
0
votes
1
answer
18
views
Can anyone tell me why this doesn't work?
#include
using namespace std;
int countDigit(int n)
{
int digits;
while (n != 0)
{
n = n / 10;
digits++;
}
return digits;
}
int main()
{
int number;
cin >> number;
int cycles = ...
0
votes
0
answers
109
views
Recover Assignment Memory Leak and Insufficient Recovery
I am trying to complete the assignment given by CS50x (Harvard Community Online, edX.org), and while it successfully recovers images, valgrind is telling me that there are memory leaks that happen in ...
0
votes
1
answer
66
views
CS50 PSet 4 Recover, Segmentation Fault
My code compiles, but whenever I run Check50, I get a segmentation fault error for each category. Would definitely appreciate any help identifying where the problem can be fixed!
#include <stdio.h&...
0
votes
1
answer
10
views
Need help debugging
Here is the error im getting:
./Rule.h:17:12: error: use of undeclared identifier 'Predicate'
vector preds;
Here is my code for Rule.h:
#ifndef RULE_H
#define RULE_H
#include <vector>
#...
0
votes
1
answer
5k
views
2019 CS50 PSet 4 Filter Less
https://cs50.harvard.edu/college/psets/4/filter/less/
I'm so lost I don't really know where to begin. The last exercise plurality with the distributive code was a nightmare, I only found one other ...
0
votes
1
answer
4k
views
invalid operands to binary expression ('double *' and 'double')
I am getting error with greater than operand '>'. I am sure that q1[n] hold value that is not integer. I am not sure how to do this when the q1[n] > 0.5 then c=1. Note that q1[n] is pointer to the ...
0
votes
1
answer
454
views
Week 6: DNA sequence aligning example: Are running times iterative approach and reqursive same?
once again I'm asking help ( not to provide me with code example or pseudo code ), but for clarification on the problem.
It seems that this double loop ( iterative approach )
for (int y2 = y; y2 >...
0
votes
1
answer
156
views
Lecture Week 6: Dynamic programming: rod example, is the recursion approach correct?
so then I was watching the lecture and I thought at the time it would be nice to try implement the example (well, partially at least) used in the lecture.
I have two questions:
Is my approach to ...
0
votes
1
answer
62
views
Pset 2 Vigenere: I know the problem but can't figure it out
I have little problem with CS50 pset 2 vigenere cipher.
So this is my code
#include<cs50.h>
#include<ctype.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
...
0
votes
0
answers
25
views
Doing Stack Program using arrays in C++
I'm just trying to make a stack program, i think there is error in menu ( ) function or what could be the method to print menu again and again by not going with recursion. The code runs smooth on the ...
0
votes
1
answer
4k
views
Conversion of hexadecimal to floating point
Does anybody know any way of conversion of hexadecimal to floating point? Any C, Java, C++ or any language's program that could automatically convert it or the formula to convert it manually on page ...
0
votes
1
answer
427
views
Makefile config
As we know.. in the appliance when we use the command..
. make [file-name] ..
It automatically complied with some flag....-ggdb -O0 -std=c99 -Wall - Werror
But I need to know in which directory the ...
1
vote
1
answer
454
views
Writing solutions in C++ instead of C
I know C++ from before starting CS50. If I submit a solution written in C++ for problem sets that deal with the C language, will I get credit for my solution?
0
votes
1
answer
75
views
Can I upgrade appliance for C++11?
I am an alumni of CS50. However, I still use the appliance. I was trying my hands on c++11 but the appliance I guess is configured for c++98 ( from what I have been able to judge from the errors ). So,...