Beginners - June 2015 (Page 11)

by Doge1
How to check string for any number?
 
What code to use to check string if any number are in there, if it is then return error.
[3 replies] Last: Or combine http://www.cplusplus.com/reference/algorithm/any_of/ and ht... (by keskiverto)
Default constructors variables.
 
Hi! Let's say I have a class that does not have a constructor. Does the compiler creates a default constructor that initialises my variables to 0 or just an emp...
[1 reply] : In short: it is safer to assume that compiler generated constructor do... (by MiiNiPaa)
tgamma function
 
Hello!I'm trying to use the tgamma function to solve this problem : https://www.hackerearth.com/may-easy-challenge-15/algorithm/panda-and-chain-reaction/. But I...
[no replies]
by Doge1
Is there any way i could make this code simple as possible.
 
I need tit to be beginner friendly if anyone can help to make this simplistic as possible. #include <iostream> #include <string> #include <vector> us...
[5 replies] Last: You're right, sorry. (by TheHardew)
I need help with a function returning the correct values
 
So I have an issue getting this function to work in my program for a summer course for C++. We are to create a program where a user orders food and we retur...
[2 replies] Last: THANK YOU SO MUCH I knew it was a super small fix that I was overlooki... (by Umahoin)
by ttu
Tricky increment example
 
Hi guys, I stumbled upon a tricky increment example recently. Here it is: int a, i = 0; a = ++i + ++i + ++i; Why on earth the a variable ret...
[6 replies] Last: [quote=2011 Standard] 5.17 / 1 [ expr.ass ] In all cases, the ass... (by MiiNiPaa)
calculator need help
 
trying to make a calculator just started learning c++ wats wrong with my code when i remove 3 functions it works but not with all of them there. help pls ...
[8 replies] Last: Could you please code tag the final version of your code. So any noob ... (by andywestken)
Switch Statements - Output Help!
 
Hello - This is my first post (I'm a total beginner!) but need some help. I've been working on an assignment to take a user's input string and output the corres...
[4 replies] Last: Perfect! Thank you so much! That worked. (by eiffel79)
by omurad
Modulo issue
 
if (arrayLength % 2 == 0) //ERROR: invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’ The type of "arrayLength" is a double and...
[2 replies] Last: Makes sense... Good thing I posted this in the beginner category lol. ... (by omurad)
Read .txt file
 
Hi, i need some help in the following program: I have to read from a .txt file, that contains integers and then cout the most occurred number with the number o...
[2 replies] Last: How large are your integers ? If the numbers are small, like 1 - 20 t... (by SamuelAdams)
Static object member of the same class
 
Why is this code legal in C++? class myClass { public: int someInt; static myClass subObject; // infinite loop? }; Wouldn't it cause an inf...
[2 replies] Last: Ah. It's all clear now. Thank you :) (by bheadmaster)
Initializing an Array of Strings
 
I am trying to write a simpler code to initialize my string array instead of having to enumerate everything as I have done in my code. Is there a more efficient...
[7 replies] Last: @MiiNiPaa Awesome. Thank you so much for the response!!! I understand... (by jhykima)
Question about cout << endl statements
 
How come in these line of code the endl code precedes the << string ;? Meaning why did the author of my textbook structured the statement cout << endl << strin...
[6 replies] Last: Side note: endl is really overused. Just output a "\n" in the right ... (by Duthomhas)
Code::Blocks build fails
 
Learning C++ although I did some self taught hobby C programming a long time ago. First I started up Code::Blocks and chose "create a new project". In the N...
[3 replies] Last: If your tutorial recommend fstream.h, it likely is, as that isn't even... (by Zhuge)
problem with objects and classes
 
i have written down this program in codeblocks (gnu c++ compiler) using the concept of classes and objects but when i compile it it should return 12 but when ...
[2 replies] Last: thanks very much newbiee999 (by kartik17)
Memorization Program
 
I am trying to make a program that takes file input from something in Latin "EcceGratum.txt" and then prompts the user for English (in this case), comparing it ...
[3 replies] Last: To solve the max() problem add #include <algorithm> It must have b... (by andywestken)
Tons of Errors, Please Help.
 
What is Ostream Operator? #include <iostream> #include <ostream> #include <unistd.h> using namespace std; long double firstVariable(0); long double seco...
[3 replies] Last: Line 37: what is logically wrong with cin << endl ; Line 13: Do you ... (by keskiverto)
by Nedim1
Output of a vector, why doesn't this work?
 
Why doesn't this code work? #include <iostream> #include <vector> using namespace std; int main() { vector<int> prime={1, 2, 3, 4, 5, 6, 7, 8, ...
[1 reply] : i <= prime.size() should be i < prime.size() That is, you're pr... (by andywestken)
Funky string concatenation
 
Some weird stuff is happening when I try and concatenate strings and chars. For example, this is inside of a static member function: int id = 0; char cid...
[1 reply] : operator+, operator-, etc are evaluated left to right. So subterm cid... (by andywestken)
Classes questions
 
Alright so I don't know if there is a better way to go about this but I'm somewhat doing it like how we had to do in an assignment during the previous semester....
[1 reply] : Line 41. This is not how to express what you want. What you should sa... (by booradley60)
June 2015 Pages: 1... 910111213... 32
  Archived months: [may2015] [jul2015]

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