Category : cout

so, i’m trying to solve one of the URI online Judge’s problems for beginners in C++ (specifically the area problem: https://www.urionlinejudge.com.br/judge/en/problems/view/1012), and i’m trying to print out the arimetics of floating numbers using cout, but i cant, the problem is that the aritmetic is returning only 0.000, and i don’t know what to do. I ..

Read more

Using c++17 I have a header file colors.hpp to help me with colored output to stdout: #pragma once #include <string> namespace Color { static const std::string yellow = "u001b[33m"; static const std::string green = "u001b[32m"; static const std::string red = "u001b[31m"; static const std::string end = "u001b[0m"; } I often use it like this: std::cout ..

Read more

I have the following function: void setFore(const short arg) { char ansicode[12] = "e[38;5;"; char code[4]; snprintf(code, 4, "%d", arg); strcat(ansicode, code); strcat(ansicode, "m"); std::cout << ansicode; } Using it looks like std::cout << "Some text"; setFore(50); std::cout << "Some textn"; After execution, array ansicode is deleted automatically. I want to make the function like ..

Read more

I made a solution for problem 11340 in OnlineJudge.org (https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2315), problem is quite simple, read an article and determine its cost based on a list of prices per character. I get the correct output on the given tests and also on the extra test found on https://www.udebug.com/UVa/11340, yet my code throws Wrong Answer on the ..

Read more