Help me to correct the code or tell the mistakes, pls!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
28th Feb 2020, 4:46 PM
Anastasiia Kudria
Anastasiia Kudria - avatar
8 Answers
+ 2
This will likely not solve all your problems, because you have many semantical and syntaxical errors, but its a start at least
28th Feb 2020, 6:01 PM
Kylie
Kylie - avatar
+ 1
You assigned your C variables with double quotes “ “, char variables only accept one character in ‘ ‘ so you either have to make the variables a type String or make an array of chars with each individual letter char c = “abcd” is invalid char c = ‘abcd’ is also invalid char c = ‘C’ is valid char[] c = {‘A’, ‘B’, ‘C’} is valid String c = “abcd” is valid
28th Feb 2020, 5:56 PM
Kylie
Kylie - avatar
+ 1
Well, I'll try it later. Thanks ♥️😘
28th Feb 2020, 6:00 PM
Anastasiia Kudria
Anastasiia Kudria - avatar
+ 1
Ok. I'll work on my mistakes. Thanks again 😌
28th Feb 2020, 6:03 PM
Anastasiia Kudria
Anastasiia Kudria - avatar
+ 1
Salam, 1st : Remove this header file: <Conio.h>. The Borland Turbo C++ compiler supports "conio.h," but the GCC compiler doesn't. Beginner C/C++ programmers and some books use this file, but it isn't recommended to use it. 2nd : Replace gets(s) with fgets(s, 256, stdin). gets() was deprecated in C++11 and removed from C++14. Add 'const' in line 17 and 18: const char *C = ...... const char *c = ..... Replace getch() with getchar().
29th Feb 2020, 1:58 PM
Rafik Abdelhak Nadir
Rafik Abdelhak Nadir - avatar
0
A couple of your issues are your include statements are comments and youre trying to assign a String to a char variable
28th Feb 2020, 5:25 PM
Kylie
Kylie - avatar
0
Omg... I'm a beginner in C++. So i can't understand what do u mean when say "to assign a string to a char var." Why not? Can u show me on an example?
28th Feb 2020, 5:46 PM
Anastasiia Kudria
Anastasiia Kudria - avatar
0
So, I should do the array like this one char*C[ ]={'A', 'B' .... }; right?
29th Feb 2020, 1:55 PM
Anastasiia Kudria
Anastasiia Kudria - avatar