Beginners - December 2019 (Page 11)

Calculate square of number with sum of odd numbers
 
Hello, I want to Calculate the square of the number with sum of odd numbers. For example, n = 5 and square of it is 25. I want to calculate it with sum of o...
[5 replies] Last: @jonnin Prove: (i = 0)S(n) 2n + 1 = (n + 1)^2 [this is the theorem ... (by genuaapis)
by ema897
.open() doesn't open files
 
Hi! I have a strange problem with files. I used method .open() to open file, but I think it doesn't work. The code is: #include <iostream> #include <fstre...
[4 replies] Last: @coder777, He says that the open command didn't fail and yet, magicall... (by dutch)
Number of elements string array
 
How can I find the number of elementos of a parameter passed string array? I can't do unsigned int size = sizeof(kings) / sizeof(*kings); and pas...
[3 replies] Last: see if the ideas in here help: http://www.cplusplus.com/forum/general... (by jonnin)
by Bopaki
Not sure why I get thise errors:
 
error: expected primary-expression before '{' token error: expected `;' before '{' token #include<iostream> #include<vector> #include<iterator> #inc...
[3 replies] Last: It seems you’re using old C++ syntax. Try to tell the compiler you w... (by Enoizat)
by Djpich
Segmentation Fault and I don't know why.
 
So the following piece of code gives me a segmentation fault and I can't figure out for the life of me why. What I'm trying to do is basically build a pool from...
[4 replies] Last: No worries - glad I could help! (by MikeyBoy)
by Bopaki
Having problems with iterators & vectors
 
Can't work out what is the problem here: I get this error: codeBuildsFine.cpp:11:9: error: no match for 'operator=' (operand types are 'std::vector<int>' a...
[1 reply] : Update your compiler to c++11 or later. (by lastchance)
Method declaration
 
Whats the c++ pattern to naming methods? Camel case for everything?
[2 replies] Last: Consistency is paramount, but before you go and decide what you like, ... (by Duthomhas)
Linker command failed
 
I'm trying to compile my .cpp files with this Make file rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d)) SOURCE_F...
[1 reply] : Found it, I declared a constructor signature but didn't implement it. ... (by Lucas Fiorini)
error: no match for 'operator='
 
I am trying to compile sample code but code show errors #include<iostream> using namespace std; class base{ public: virtual void funct...
[1 reply] : #include<iostream> using namespace std; class base { public: ... (by againtry)
Unknown type name 'string'
 
I'm trying to compile my code .cpp but even though I include the libraries I get those errors: error: unknown type name 'string' static stri...
[2 replies] Last: Oh I didn't! Thanks! (by Lucas Fiorini)
String comparison
 
What is c++ comparing when I have a code like this: string a = "car"; string b = "aar"; if (a > b){ cout << b << " " << a << endl; } Can I ...
[1 reply] : It performs a (by default, case sensitive) lexicographical comparison ... (by JLBorges)
Condition FOR not number characters
 
the if else statements works for numbers only When the option is only number , if the user type any not number The program must Give a notice Invalid input b...
[6 replies] Last: If you got rid of those ugly gotos, your code, especially your main(),... (by Enoizat)
How does this read() function work?
 
The following read() function receives the integers provided by the user. I especially do not get it how the --n; line prevents the counting of the 0. void...
[6 replies] Last: the first thing about improving code is to fix screw ups and make it R... (by jonnin)
by iOsama
help with calculating the area
 
i have to write a c++ program to estimate the area under the curve y=x^2 from x1=1 to x2=10 and i have to use Riemann sum to compute the area for n=10 n=100 ...
[1 reply] : Do you know how to do this with paper and pencil? That would be the fi... (by Ganado)
go fish!
 
Put the code you need help with here. This is my code so far for a go fish game. I'm having trouble looping through each card to check if it's the value the p...
[2 replies] Last: I have my header files which were given by my professor so I know they... (by bethmayweather)
by KeRn
DLL Hook -> Edit GameIP Problem
 
i have the following problem, i have a game exe in this is e.g. this IP 127.0.0.1 <- String i want to replace with 11.111.11.11 <- string . With my code below ...
[4 replies] Last: This is Working: strncpy((char*)Offset, "11.111.11.11", 12); the Probl... (by KeRn)
by Ab3s
How do i check every element of an array for a condition?
 
I want to check which elements of an array contain the word "circuit", yet i have no idea where to even start...
[1 reply] : What do you need that information for? The "contain" can be inteprete... (by keskiverto)
How Encapsulation is different from data hiding
 
I am new here I am confused by reading this page https://en.wikipedia.org/wiki/Data_encapsulation This page says Data encapsulation, also known as data hidin...
[5 replies] Last: https://cboard.cprogramming.com/cplusplus-programming/178382-how-encap... (by salem c)
Recursion function problem not returning correct answer
 
To give you a brief summary of the code it is basically trying to find the root of a function between two points using bisection. My code works perfectly, but ...
[2 replies] Last: Oh duh, thank you! (by nickbarry12)
by Hex213
Macros and existing function
 
Hi, I need help with a little problem. As a source I wrote overloaded func in another source file. Linked to .h and I need to create a macro that runs one of t...
[9 replies] Last: #define OS_A #if defined (OS_A) void func(long a, long b) { ... (by Ganado)
December 2019 Pages: 1... 910111213
  Archived months: [nov2019] [jan2020]

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