Beginners - January 2018 (Page 6)

How to fix the error?thx a lot
 
Line 10: expression cannot be used as a function #include<stdio.h> #include<string.h> struct Point{ int x; int y; }; int Point_init(struct Point* b...
[2 replies] Last: thx bro,i make a stupid mistake.And ur advice is very useful to me! (by toby1a05)
Implementing Classes into a Program
 
So I wrote a code for a project and it worked fine, but another part of the project is to implement classes. I've been trying to write a class for the operation...
[3 replies] Last: class mathOperations // class that contains your basic math function... (by fiji885)
Converting between data types? C++
 
I'm getting an error saying cannot convert char to double. i declared double and int type in the structure. How would I fix this? Im still in the beginning ph...
[2 replies] Last: Helped me out so much, thanks a lot it worked! (by tidematic)
invalid conversion from 'const char*' to 'unsigned int' [-fpermissive]
 
how do i fix this? //Tests if the C string str starts with the specified prefix, the C string prefix. bool startsWith(const char* str, const char* prefix...
[8 replies] Last: ok, goodness. I think this covers everything except null pointers pa... (by jonnin)
by evdo
doesnt work
 
"You have to create a class, named Student, representing the student's details, as mentioned above, and store the data of a student. Create setter and getter fu...
[2 replies] Last: Also, you have to create another method to_string() which returns the... (by Thomas1965)
C++ goto replacement
 
Hello, I am beginner in C++ and I would like to ask you if this is a good replacement for goto or not. //GOTO WAY: int main() { start: cout << "star...
[8 replies] Last: No. Structure your code so that it does not need goto -like construct... (by Duthomhas)
String array as object params
 
So, basically, I have a Question object with the constructor Question(string question, string answer1, string answer2, string answer3, string answer4, int cor...
[7 replies] Last: Ah. So my error was because I was instantiating it as a vector rather ... (by The hemporer)
Using a function in another class
 
I'm trying to use a function from another class (my Question class) to basically run the game, but it's not allowing me. It just doesn't run it for some reason....
[2 replies] Last: I'm an idiot. Thank you. (by The hemporer)
C++ Quincy beginner code question
 
I am having a hard time creating a code for this: If TEST score is less than 80, then increase TEST score by 5; else increase TEST score by 7%. This is what I...
[3 replies] Last: To give you an idea... #include <iostream> int main() { const int ... (by chicofeo)
Importance of storage
 
I want to know that whether storage is an issue with respect to current hardware and software market?? Because in certain conditions we have to choose between s...
[3 replies] Last: storage is huge on some systems, like mobile devices or embedded compu... (by jonnin)
by YikUTM
Convert string to char. No desired output
 
I tried to convert strings which are read from external input file into char however I didn't get my desired result... My desired output CS0900001 CS100...
[7 replies] Last: That works. Use that instead! (by jonnin)
Forward declare objects in C++?
 
Hi there! I just made this code and I can see why it isn't working but not how to solve it. So I need to forward declare object "toilet" but I don't know. If y...
[9 replies] Last: I will mark this thread as solved now. This is pretty much my final co... (by Sigge414)
by m mohy
where is the error?
 
I am trying to write a code to calculate the angle between a point on line and another moving point, but there is conversion issue between variable types for ha...
[7 replies] Last: @jonnin It is supposed to calculate the angle between a moving point, ... (by m mohy)
by Rodev
cout string without including <string>?
 
Hello, I was testing some code and I found out that I didn't need to put "#include <string>" in order to initialize a variable with a string and output it. ...
[9 replies] Last: This change (single-element braced-init-lists initialize directly) was... (by JLBorges)
Unexplainable Errors
 
I'm trying to write a code that will find the smaller number between to numbers and print the smaller numbers #include <iomanip> #include <iostream> #i...
[2 replies] Last: You also need to call the function you created after receiving the sec... (by II47II)
Using user inputs in functions
 
Im writing a code for class that takes 7 inputs from the user as cards and tells them their best poker hand. The input is #S where # is the card number and S is...
[4 replies] Last: God I'm stupid! Your comment made me think why i used pointers in the ... (by MitchH29)
by YikUTM
Unwanted blank line in output
 
When I run my program, it printed an unwanted blank line. Is there any way to fix this? The output I wanted david 34 24 ls 45 35 haha 56 23 What I got d...
[3 replies] Last: Your input (underlined) is: david 34 24 ls 45 35 haha 56 23 Note ... (by dhayden)
Saving data from 2D-array to a text file.
 
Hi, I have done lots of googling but I have a 2D-array of type double and I want to save it to a file, so I can then plot the data using matplotlib in python,...
[3 replies] Last: Thankyou for this @fiji885 it worked perfectly! @lastchance for this p... (by indiarose27)
by H00G0
Sort algorithm on vector of structures (1,2)
 
Hello people! I've found a few posts here and there about people having the same problem as me but I couldn't quite make sense of them. Let's say I have s...
[26 replies] Last: Think of threads, parallelism. Two threads execute simultaneously. Yo... (by H00G0)
Beginner C++ question
 
I have never used C++ before and I need to design a program to do the following: The BONUS on a salesman’s SALES is a. zero if SALES is less than $2000...
[2 replies] Last: int main() { unsigned int sales = 0; std::cout >> "enter sales\... (by Pintujoshi)
January 2018 Pages: 1... 45678... 22
  Archived months: [dec2017] [feb2018]

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