
Concept explainers
im not getting what im doing wrong, coding for c++
Write a
Ex: If the input is:
7 15 3
the output is:
3
#include <iostream>
using namespace std;
int main() {
int a = 3, b = 15, c = 7;
cout << a << b << c;
cin >> 3 >> 15 >> 7; //a = 3, b = 15, c = 7
if (a < b && a < c)
cout << " a " << 3;
}
else if (b > a && b < c)
cout << " b " << 7;
}
else (c < a && c < b)
cout << " c " << 15;
}
return 0;
}

There are several issues with your code. I'll correct them step by step:
- You should remove the initial assignments to
a
,b
, andc
because you want to take user inputs for these values. - You should use appropriate variables in your
if
conditions. - You need to use
&&
for the conditions properly. - You should remove unnecessary numbers from the
cin
statement.
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 1 images

this is the error im getting now
main.cpp:16:4: error: expected unqualified-id before ‘else’
16 | else if (b <= a && b <= c)
| ^~~~
main.cpp:19:4: error: expected declaration before ‘}’ token
19 | }
| ^
main.cpp:21:4: error: expected unqualified-id before ‘else’
21 | else {
| ^~~~
main.cpp:27:4: error: expected unqualified-id before ‘return’
27 | return 0;
| ^~~~~~
main.cpp:28:1: error: expected declaration before ‘}’ token
28 | }
| ^
this is the error im getting now
main.cpp:16:4: error: expected unqualified-id before ‘else’
16 | else if (b <= a && b <= c)
| ^~~~
main.cpp:19:4: error: expected declaration before ‘}’ token
19 | }
| ^
main.cpp:21:4: error: expected unqualified-id before ‘else’
21 | else {
| ^~~~
main.cpp:27:4: error: expected unqualified-id before ‘return’
27 | return 0;
| ^~~~~~
main.cpp:28:1: error: expected declaration before ‘}’ token
28 | }
| ^
- THIS IS FOR C++ ONLY Part 2b: Password Verification A secure password is critically important in today's world. Organizations typically have stringent requirements to ensure a password is complex enough so as not to be easily hacked. Write a program that will accept as input a potential password and determine whether or not it is valid in meeting the following criteria: at least eight characters long at least one uppercase letter at least one lowercase letter at least one digit at least one special character (you can determine what is acceptable) If the password is valid, ask the user to enter it again. If it matches, indicate the password has been accepted. If the password does not meet any of the above criteria, indicate which it does not meet.arrow_forwardPlease code using C++ and only use the header <iostream>. The use of any other headers will not be accepted. Thank you.arrow_forwardThis is C++ Please i need it ASAP I will give you thumbs uparrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





