Beginners - March 2018 (Page 12)

by Cp9
string accepting only numbers
How I can check if credit card numbers contains only of numbers? # include <iostream> # include <string> # include <iomanip> using namespace std; ...
Mar 18, 2018 at 11:15pm
[2 replies] Last: if ( creditCard.find_first_not_of( "0123456789" ) == string::npos ) c... (by lastchance)
How to access the last character in an element of string array
I am provided with a coded message, a definition list, and asked to write a program to translate the message. And the definition list looks like this: A =...
Mar 18, 2018 at 11:03pm
[2 replies] Last: Sorry about that. Here's the code. It's pseudocode though because I do... (by knguyen2081)
How to replace NaN values in text file? (1,2)
I'm fairly new to C++ programming and I am working on my first project. The current issue I am facing right now is that after I read in my file, the data in the...
Mar 18, 2018 at 11:02pm
[22 replies] Last: The following is in order of columns: Square ID(GRID ID), Time Interva... (by nicholasjb1996)
Square root
i need help finding square roots without the math library. what im using is this //square=total length of 1d array void uMatrix::sqrt(int square) { ...
Mar 18, 2018 at 10:57pm
[1 reply] : root = ((root + square) / root) / 2; Slightly wrong. The Babylonian... (by Ganado)
by zapshe
std::cin and whitespace - not consistent?
Alright, I've been having a weird experience with std::cin - hope someone can clarify things for me. std::cin doesn't accept white space as part of the input. H...
Mar 18, 2018 at 10:54pm
[5 replies] Last: Thanks Peter, that looks pretty handy, I'll make sure to remember it f... (by zapshe)
question about maps
i have a question about maps, im working on a spell check i have load dictionary which is going to be a set, and i have that correct, but for the map part im co...
Mar 18, 2018 at 10:26pm
[1 reply] : I'm not sure if a map would be the best option for a spell-checker, I'... (by Ganado)
Trouble using an input facilitator function to read a list with tabs.
Working on a small ungraded assignment for my class and have stumbled upon a problem. We are suppose to be using a facilitator input function (see below) to rea...
Mar 18, 2018 at 10:25pm
[4 replies] Last: If a string contains space you need to use getline with '\t' as delim... (by Graff527)
Mail Order type application
I'm trying to do an application that allows the user to enter a 4-5 character string consisting of a number, two letters that determine the output, and then 1 o...
Mar 18, 2018 at 10:02pm
[6 replies] Last: So I should be using ==? (by Databend)
what excactly are atrributes in a class?
so we got a assignment from school and we have to create a class but I don't quite understand what they mean with attributes. [ #include <iostream> class F...
Mar 18, 2018 at 9:33pm
[1 reply] : Hello king2105, PLEASE ALWAYS USE CODE TAGS (the <> formatting button... (by Handy Andy)
by pevecg
Setting value to dynamic class object
Hello, so I am playing around with classes and I pretty much understand them apart from the fact how do you set a value to dynamic class object. void Account...
Mar 18, 2018 at 9:30pm
[1 reply] : Nevermind, I realized that when testing this, I didnt initialize the a... (by pevecg)
by pizza
Why Pass String By Reference
Hello. I learned that when you pass something by reference not by value, the program doesn't make another extra copy which makes my program efficient and, whate...
Mar 18, 2018 at 9:26pm
[12 replies] Last: Even without threads, the function may not be able to assume that the ... (by helios)
Verifying correct input
I'm creating a program that requires the input to contain a certain parameter, that being 3 digits followed by a hyphen, and then two more digits. I cannot find...
Mar 18, 2018 at 9:14pm
[2 replies] Last: Thanks! Works perfectly. (by Databend)
by Fojaxx
Prevent characters from being entered into int variable type
Hey, so i spent all yesterday working on a ratio calculator for purchasing items. the program takes a given budget limit, takes a number of inputs (1-10) rep...
Mar 18, 2018 at 8:58pm
[8 replies] Last: In most cases, the best (simplest, most straight-forward) way to valid... (by mbozzi)
Visual Studios c++ Square Matricies
i am having trouble creating a square matrix with my code. I am not allowed to use the vector library or the math library. I am restricted to iostream and fstre...
Mar 18, 2018 at 6:46pm
[3 replies] Last: Your question is not entirely clear. On one hand you talk about some ... (by keskiverto)
what excactly are atrributes in a class?
I have been googling for 2 hours and I still don't know what an attribute is in a Class. could someone give me an example? I am familiar with other aspect...
Mar 18, 2018 at 6:03pm
[1 reply] : https://stackoverflow.com/questions/18282330/c-is-it-correct-to-call-c... (by d1g1talarts)
Vector loops
Im not sure why vector d is only getting the "dog" string and not the "catd" string as well. /**********************************************************...
Mar 18, 2018 at 5:47pm
[5 replies] Last: std::string::npos http://en.cppreference.com/w/cpp/string/basic_string... (by closed account E0p9LyTq)
functions and array
my codes not working #include <iostream> #include <string> #include <iomanip> using namespace std; // Function Prototypes // These prototypes alrea...
Mar 18, 2018 at 10:48am
[1 reply] : not working Please describe that in more detail. * Fails to compile?... (by keskiverto)
by urby
Why does the output value always equal 1?
Hello, I am sorry for a basic question, however, I can not figure out why this function obtains the value of 1 for n. Here is the function: int a = 0; in...
Mar 18, 2018 at 10:43am
[6 replies] Last: Thank you for finally showing the relevant code. A compiler says: I... (by keskiverto)
Count the average from an external textfile. (containing strings)
Hey, Im trying to make a program with an external .txt file. It should contain First name, last name and the age of the persons. Then get the info from the .tx...
Mar 18, 2018 at 10:31am
[8 replies] Last: Thank you! you´re the best! I have to study more.. (by dannehess)
How to use to_string function
I am creating a function that takes two integers and adds them returning as the string "a + b = c". I have to use the to_string function and it only seems to re...
Mar 18, 2018 at 4:23am
[1 reply] : #include <iostream> #include <string> std::string addition( int a, ... (by JLBorges)
March 2018 Pages: 1... 1011121314... 29
  Archived months: [feb2018] [apr2018]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.