#include <iostream>
using namespace std;
int f[5];
int main()
{
// Get the input
std::cout << "Please enter numbers, all on one line, and end with ENTER: ";
int a=0, b=0 , c=0, d=0 ,e=0 , h=0; i;
cin >> f[0] >> f[1] >> f[2] >> f[3] >> f[4] >> f[5];
int m = max(max(f[0], f[1]), f[2], f[3], f[4] , f[5]);
for (int i = m; i >= 1; i++)
{
if (a>= 0 && a <= 19);
if (b > 20 && b <= 39);
if (c > 40 && c <= 69);
if (d > 70 && d <= 89);
if (h > 90 && h <= 109);
for (int j = 0; j < 5; j++)
if (f[j] < i) cout << ' ';
else cout << '*';
cout << endl;
}
}
#Code stoping at 3 instead of 5 as it only give prints after 3 input, i don’t know how to change it.
10 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
Code stoping at 3 instead of 5 as it only give prints after 3 input, i don’t know how to change it.
if (a>= 0 && a <= 19);
if (b > 20 && b <= 39);
if (c > 40 && c <= 69);
if (d > 70 && d <= 89);
if (h > 90 && h <= 109);
this does nothing btw
Yeah I realise that
;compile c++ | 1 2 3 4 5
Compiler Output
<source>: In function 'int main()':
<source>:9:38: error: 'i' was not declared in this scope
9 | int a=0, b=0 , c=0, d=0 ,e=0 , h=0; i;
| ^
<source>:12:16: error: no matching function for call to 'max(const int&, int&, int&, int&, int&)'
12 | int m = max(max(f[0], f[1]), f[2], f[3], f[4] , f[5]);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/string:50,
from /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/locale_classes.h:40,
from /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ios_base.h:41,
from /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/ios:42,
from /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/ostream:38,
from /opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/iostream:39,
from <source>:2:
/o
mcmlevi#6769 | c++ | x86-64 gcc 12.2 | godbolt.org
ah you shadowing your i as well
Oh
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.