Beginners - December 2017

by drs135
Writing to and reading from a file
 
I want to create a highscore system, how can i write to the file and save the input, and how to i output the data on the text file if the user selects the 2nd o...
[3 replies] Last: Is there a way i can just read the whole file and output it? #inc... (by Chervil)
by flav32
return statement
 
When and why do we sometimes return a variable instead of 0?
[6 replies] Last: I feel a bit stupid now. There are some things that I just miss withou... (by flav32)
by pavik
find '\r' character in a string
 
Here is my pice of code: void readToArray(array<string,ARR_SIZE> &arr){ string word; int crPos=0; ifstream file("input.txt"); if(file.is_open(...
[5 replies] Last: Thx for all replies. It's very usful to know the backround info descr... (by pavik)
by Handge
Multiple .cpp files or just one
 
I'm making a text RPG game in C++, and was wondering if it would be a smart idea to have the Acts split into their own .cpp files? For example main.cpp would st...
[3 replies] Last: Yes, but ... A program does operations on data. Is each act really a ... (by keskiverto)
grocery list using arrays
 
Someone, please help. Write a program that allows you to enter grocery item names into an array of strings and the cost of each item in an array of doubles. ...
[1 reply] : Figured it out myself. #include <iostream> #include <iomanip> using n... (by liz Lopez)
C++ function the norm (magnitude) of the vector
 
how to calculate he norm (magnitude) of the vector A = (a1, a2, ... ,an). #include<iostream> using namespace std; double norm (double ,int); int main ...
[3 replies] Last: #include <numeric> #include <cmath> double norm( const double x , ... (by JLBorges)
SDL context could not be created
 
I'm trying to make an SDL window, and from what I'm getting everything is running fine for the most part up until I try creating SDL context for the window. - ...
[3 replies] Last: But the compiler would notice. Compile with warnings on; use your too... (by mbozzi)
OOP inheritance error
 
Iget following error on code below, but can't understand what's wrong as I tried similar case and it works, could someone help me? 24|error: ISO C++ forbids de...
[2 replies] Last: Oh, wow, how did I miss that. Thank you! :) (by spartannn)
User inputs incorrect display error message and ask to re-enter correct input
 
I'm almost finished with my program. Just left with the error checking which I have no idea to do. I tried using do while loops but it's not working for me. I'm...
[6 replies] Last: I would've stored everything in cents using integers and only done the... (by Peter87)
if else statement problems?
 
I am new to programming. The problem I am having is at the part of withdrawal. When I input the amount to be the exact for example I have total of 2.45. When I ...
[5 replies] Last: http://www.cplusplus.com/forum/beginner/227574/ (by tfahadhafiz)
by Bopaki
Error" new_account was not declared in this scope
 
the following program is exactly as it is in the book by Walter Savitch but when I compile it I get the error in the title. //Program to demonstrate the...
[4 replies] Last: Thanks Thomas1965 the second option solved the problem. Some of the pr... (by Bopaki)
typedef struct or just struct
 
What's the difference between "typedef struct" or just "struct"?
[2 replies] Last: Now I got it! Thanks sooo much! (by Lucas Fiorini)
by cidex
Strange number with fn pow
 
So I have this loan formula K = (S * (P/100/12)) / (1 - (1 + (P/100/12))^(-Y*12)) and I converted to this double Prots = (P / 100 / 12); double Num...
[3 replies] Last: P, Y, S are all double #include <iostream> #include <cmath> int mai... (by cidex)
error in stacks: no response in stdout
 
I dont know why the programm doesnt print #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include ...
[13 replies] Last: Thanks a lot,to you too, ne555 ,you helped me with solving the problem... (by BearDone)
functions - matrix
 
Hello everyone! I have some problem with this question . The question is to program funciton which gets matrix which is not sorted and all i need to do is to ...
[7 replies] Last: i think i should have had the optimiztion of j<i (by shirshir950)
by chuvak
Returning pointer by a function
 
Is this a legal operation? And would it work the same with char* pointer ? class someClass { int value; int* pointer; public: ...
[9 replies] Last: I'm not sure about it but I would recommend to try avoid these as they... (by benhart)
by play4u
new char[] allocation returning array with wrong size
 
Hello! I'm sriting a program, for which I wrote a small function to add a character(c) at the end of an input c string (src). Pretty basic stuff. Here's the ...
[6 replies] Last: Make sure you know how to use allocation the right way and control it ... (by benhart)
c++ program help fix the code set operation arrys
 
the question is : Q-1: Set Operations: Write a C++ program that uses one dimensional arrays to implement Set operations i.e. union, difference and intersect...
[3 replies] Last: those kind of errors occur and handled after running for the first tim... (by benhart)
FUNCTIONS
 
Hello everyone! I have a really important homework that will take only like 30 minutes to be done but I find it difficult to do it.It is a really important to ...
[1 reply] : Post your code (by SamuelAdams)
by ZekDe
ASCII Protokol
 
Write your question here. Hi guys, I need device to device limitless data transfer with C or C++,How can I solve this problem ,I'm using Uart protocol 1 byte
[2 replies] Last: first uart is not a protocol, it's a actual chip in the device. I'm no... (by SamuelAdams)
December 2017 Pages: 123... 23
  Archived months: [nov2017] [jan2018]

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