0

C++ my code

Please help, I can’t compile my code

17th Jan 2018, 5:10 AM
Andrey Sadofyev
Andrey Sadofyev - avatar
8 Respostas
+ 4
Compiles now. Tagged changes with comments. https://code.sololearn.com/cyJIfYlto2rQ/?ref=app
17th Jan 2018, 5:28 AM
John Wells
John Wells - avatar
+ 11
1st problem: All of your insertion << and extraction >> operators are invalid characters (probably you have copied and paste the code from somewhere else without polishing it!). 2nd problem: Russian characters are Unicode so you gotta use wcout instead of cout. 3rd problem: the for loop statements are completely invalid. it'd be something like for (int x = b; x >= a; --x) 4th problem: you've used "else" condition without any "if" to make a pair. There may be some other problem as above problems consequences.
17th Jan 2018, 5:30 AM
Babak
Babak - avatar
+ 11
Yes, sir. Thank you. In fact, after putting the code inside VC++ environment I noticed that log and sqrt functions were also in the Unicode format, so I had to retype them again.
17th Jan 2018, 6:09 AM
Babak
Babak - avatar
+ 5
Note @Babak statement about Unicode. I know you don't get Russian output as written. I've played a little bit with Spanish Unicode and so far failed to get it to work. You can try: wcout<<L"До: "; It got my Spanish closer to what I was looking for.
17th Jan 2018, 6:07 AM
John Wells
John Wells - avatar
+ 4
@Babak you got the visible ones. There was also unprintables on some lines.
17th Jan 2018, 5:45 AM
John Wells
John Wells - avatar
+ 2
Thank U very much!!!
17th Jan 2018, 6:01 AM
Andrey Sadofyev
Andrey Sadofyev - avatar
0
#include<iostream> #include<Windows.h> #include<cmath> #include<stdio.h> #include<math.h> using namespace std; int main() { SetConsoleCP(1251); SetConsoleOutputCP(1251); double y,y2,a,b; cout«"Пожалуйста, \n введите с клавиатуры диапазон аргумента (Х)"; cout«"От: "; cin » a; cout«"До: "; cin » b; cout « endl; cout«"Таблицa значений функции f(x) = sqrt(​ln(​x)) и f(x) = pow((​ln(​x)), 1/4)\n"; cout«"X | sqrt(​ln(​x)) | f(x) = pow((​ln(​x)), 1/4)\n"; for (int x>=a; x<=b;) { y = sqrt(​log(​x)); y2 = pow((​log(​x)), 1/4); cout«"|"« x « "|" « y «"|" « y2 «"|" «endl; } else cout«"Не все поля заполнены."\n; system ("pause"); return 0; }
17th Jan 2018, 5:11 AM
Andrey Sadofyev
Andrey Sadofyev - avatar
0
☝️This code
17th Jan 2018, 5:11 AM
Andrey Sadofyev
Andrey Sadofyev - avatar