Beginners - September 2019

How to output message is input is the wrong length
 
How do I output a message is the input is the wrong length int main() { int code; int year , day , month; cout << "Enter a date:"; cin >> dig...
[1 reply] : Read it into a string and use .length() (by jonnin)
Problems with ifstream
 
I need to create an assignment in which calculates the total price of a list of items and their quantities, however I'm having trouble extracting the numbers fr...
[1 reply] : I'm not sure if this is your problem but why are you declaring a, c, a... (by Too Explosive)
input isn't passing into a class.
 
results of add(), sub(), etc. aren't printing out... Here's the actual code #include <iostream> #include <algorithm> #include <string> using names...
[5 replies] Last: Why are you trying to do OUTPUT in your INPUT routine? Also, since it ... (by lastchance)
How do I check the second character of this string?
 
Hello, I'm working on a program that needs to check a 6 character string, and if the characters I've inputted don't match specific conditions then the program e...
[6 replies] Last: <3 (by zapshe)
timezone issue
 
I have an issue about making a timezone between departure time, destination time with the specific place timezone #include <stdio.h> int main() { in...
[2 replies] Last: if(0<=s && s <=23 && 1<=t && t <=12 && -5<=f && f <=5 ) I don't se... (by deathzine)
Error C1083 part 1
 
Cannot locate source file. how can I add std:: to all vectors, strings, ifstream and ofstream to get rid of errors #pragma once #include "scholarshipClassDecl...
[1 reply] : using std::cout; //remove std:: from cout, as an example (by jonnin)
Unable to Round Up
 
[Write your question here.] I am working on a program to convert degrees Fahrenheit into degrees Celsius, but am unable to round the result to the nearest i...
[4 replies] Last: Using iostream flags really doesn't alter the stored decimal portion e... (by George P)
by jonnin
2D array formatting
 
int main() { double tbl ; double *dp = &(tbl ); for(int i = 0; i < 100; i++) dp = i; //table set up and loaded. its a 5 x 20 for example....
[3 replies] Last: oh whee, another rage-quit poster. (by George P)
Output isn't showing a number I need
 
I have this code completed. But it isn't showing me my first number that I know exist within these parameters. I should have 4 numbers displayed but I only rece...
[10 replies] Last: In a nutshell... floating-point math. I don't know specifically what ... (by Ganado)
Trouble reading in Chars, adding them together as a string with If Statements.
 
I'm writing a program and I'm in the final stage from it. I'm reading in these forumlas from a file that have letters and numbers. There's some cases where I ne...
[11 replies] Last: I've already showed you how to add `a' and `b' if they are char zapshe... (by ne555)
Characters not being detected.
 
Good day. I've written this program to print the amount of times a character is found,and am using for loops to do so. However,when I compile and run the progra...
[2 replies] Last: Hello kings0d, In addition to what jonnin has said. In line 24 the... (by Handy Andy)
SDL problem :: entry point must be defined
 
Hi guys, I'm having problems setting up SDL on my IDE, I am using MSVC 2017 x86 I downloaded the pre compiled zip from https://www.libsdl.org/download-2.0...
[16 replies] Last: Close. By commandeering main(), SDL can avoid multiplying code for e... (by Duthomhas)
Trust issues.
 
If you have a dynamic array of strings and you delete it, will the strings still delete their dynamic arrays? #include <string> int main(){ std::s...
[12 replies] Last: Thanks for the clearing up, was a little confused on what he meant. ... (by mbozzi)
stepwise refinement and top down
 
Just looking to double check if I am right with my thinking of these two. From what I have read, top down is just breaking a bigger task into smaller tasks whic...
[3 replies] Last: Humans can't eat an entire whole cow. It has to be cut up into smalle... (by George P)
std::unique() to compare two vectors? (1,2)
 
Is it possible to have std::unique() compare two separate vectors? For example: - Vec #1 = {1, 2, 3, 4, 5} - Vec #2 = {0, 2, 10, 11, 12, 13, 14, 15} std...
[20 replies] Last: [quote=jlb]That last '3' has nothing to do with 13, it is being caused... (by PiggiesGoSqueal)
compile time cast stack into vector
 
Hi. Everyone. I want to ask, if it is possible, to cast a mount of memory allocated in the compile time into a std::vector? // I want to allocate suc...
[3 replies] Last: A std::vector's size can be set at compile time, but once created the ... (by George P)
What is the difference between passing the pointer to a function vs passing the address of the pointer to the function?
 
If I create a pointer in main I can pass it to a function by just passing the pointer or I can pass the address of the pointer, but what's the difference. I ...
[3 replies] Last: So in example 1 we have a pointer pointing to another pointer pointin... (by keskiverto)
Reading in one character at a time
 
Hey guys, I have something where we have to solve how to read in chemical formulas and use a binary search to find the specific elements and multiply them to ge...
[10 replies] Last: Well, feel free to add - structs instead of map - binary search (prece... (by lastchance)
Garbled output from branching.
 
Good day. For a assignment,I needed to write a program that could decode twitter acronyms via branching. However,when I ran the program,I got output like this. ...
[5 replies] Last: This helps a lot. Thanks for the help and the advice on naming convent... (by kings0d)
Finding the side of a triangle using only a side and angle (SohCahToa)
 
I'm solving this problem: https://open.kattis.com/problems/ladder Problem Summary: - You need to buy a ladder so you can fix some leaks in your roof. - The lad...
[2 replies] Last: std::sin works in radians. You're feeding it the angle in degrees. A... (by PiggiesGoSqueal)
September 2019 Pages: 123... 13
  Archived months: [aug2019] [oct2019]

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