Anonymous
Anonymous
Roshan
Dark
am i mapping a PE correctly? because i feel like something is wrong https://ibb.co/f8QGrKx
Alamain
/* 11854
#include <stdio.h>
int main()
{
long long a , b , c ;
while(scanf("%lld%lld%lld",&a,&b,&c)==3)
{
if(a==0&&b==0&&c==0)
{
return 0;
}
if(a*a==b*b+c*c)
{
printf("right\n");
}
else if(b*b==a*a+c*c)
{
printf("right\n");
}
else if(c*c==a*a+b*b)
{
printf("right\n");
}
else
{
printf("wrong\n");
}
}
return 0;
}
*/
Alamain
UVA problem- 11854
Alamain
Explore this problem
Ravi
char jina[], not only char jina
Anonymous
1. never use using namespace std;
2. Try to use code blocks or pastebin
Anonymous
#include <string>
std::string jina
Anonymous
as you using namespace std;, you'll have to use string instead of std::string
Anonymous
Anonymous
also You should maybe use getline() instead od redirecting stdin, getline lets you have spaces when redirecting stdin doesn't
mito
Anonymous
Anonymous
I recently fell in love with a math problem - 3x+1 problem, Idk why I love it so much
Anonymous
I even made some code to calculate it recursively until the problem is reached:
#include <iostream>
long long unsigned int calculate(long long unsigned int x) {
std::cout << x << "\n";
if (x <= 4) {
std::cerr << "3x+1 problem reached." << "\n";
return 0;
}
long long unsigned int num;
if (x % 2 == 0) {
num = x / 2;
} else {
num = x * 3 + 1;
}
return calculate(num);
}
int main() {
calculate(7);
return 0;
}
Anonymous
/getcbook
MRT
😂
Anonymous
wtf
Anonymous
wtf
it's a thing on telegram lol
Anonymous
it's useful for bots
mito
Anonymous
I see
Anonymous
Anonymous
He made me fell in love with it
mito
Anonymous
Anonymous
;)
Naman
Can i get some courses similar to that of cs 50?
Anonymous
Ok
Anonymous
anyway
Vishwa
// a program for registering 18 + years old students
#include <iostream>
using namespace std;
int main() {
char jina[60];
cout<<"Enter your full name please \n" ;
cin >>jina;
int age ;
cout<<"WELCOME TO TOPHER ENGINEERICS \n ";
cout << "Enter your age please ";
cin >> age ;
if (age >= 18) {
cout << "please wait.....\n You qualify 😊😊 \nkindly contact us though raphaelsarota@gmail.com, attach your cv"; // << age << endl;
}
else {
cout << "sorry you're young \n "; //<< age << endl;
}
//cout << "you'll join us @ 18.";
return 0;
}
Vishwa
Vishwa
Anonymous
Anonymous
// a program for registering 18 + years old students
#include <iostream>
#include <string>
int main() {
std::string jina;
int age;
std::cout << "Enter your full name please: ";
getline(std::cin, jina)
std::cout << "WELCOME TO TOPHER ENGINEERICS" << "\n";
cout << "Enter your age please: ";
getline(std::cin, age)
if (age >= 18) {
cout << "please wait....."
<< "You qualify 😊😊"
<< "kindly contact us though raphaelsarota@gmail.com, attach your cv"
<< "\n"; // << age << endl;
} else {
cout << "sorry you're young" << "\n"; //<< age << endl;
}
//cout << "you'll join us @ 18.";
return 0;
}
Anonymous
let me try to compile it
Official hooligan of Pius XII
doesn't getline actually require references?
Anonymous
heh wait
Anonymous
works btw
Anonymous
i had some issues heh
Anonymous
// a program for registering 18 + years old students
#include <iostream>
#include <string>
int main() {
std::string jina;
std::string age;
std::cout << "Enter your full name please: ";
getline(std::cin, jina);
std::cout << "WELCOME TO TOPHER ENGINEERICS" << "\n";
std::cout << "Enter your age please: ";
getline(std::cin, age);
if (stoi(age) >= 18) {
std::cout << "please wait....." << "\n"
<< "You qualify" << "\n"
<< "kindly contact us though raphaelsarota@gmail.com, attach your cv"
<< "\n"; // << age << endl;
} else {
std::cout << "sorry you're young" << "\n"; //<< age << endl;
}
//cout << "you'll join us @ 18.";
return 0;
}
Anonymous
had to test it if it really works
Anonymous
ari@ari-arch ~ % g++ e.cpp
ari@ari-arch ~ % ./a.out
Enter your full name please: ari no
WELCOME TO TOPHER ENGINEERICS
Enter your age please: 73
please wait.....
You qualify
kindly contact us though raphaelsarota@gmail.com, attach your cv
ari@ari-arch ~ % ./a.out
Enter your full name please: hi
WELCOME TO TOPHER ENGINEERICS
Enter your age please: 2
sorry you're young
Anonymous
lol, why does the name variable even exist if it's just unused?
Anonymous
👍
Sandeep
void sol(int a1[], int a2[], int n, int m)
{
int l = 0, h = n - 1, idx = 0;
//---------------------------------------------------------
while (l <= h) {
// select the median of the remaining subarray
int c1 = (l + h) / 2;
// select the first elements from the larger array
// euqal to the size of remaining portion to the
// right of the smaller array
int c2 = n - c1 - 1;
int l1 = a1[c1];
int l2 = a2[c2 - 1];
int r1 = c1 == n - 1 ? INT_MAX : a1[c1 + 1];
int r2 = c2 == m ? INT_MAX : a2[c2];
// compare the border elements and check for the
// target index
if (l1 > r2) {
h = c1 - 1;
if (h == -1)
idx = 0;
}
else if (l2 > r1) {
l = c1 + 1;
if (l == n - 1)
idx = n;
}
else {
idx = c1 + 1;
break;
}
}
Sandeep
Sandeep
Rocky
Best books for C++ beginners
Rocky
Any suggestions
Vishwa
It works for me
Vishwa
why though, in C++ we have std::string, wait
Enter your full name please
raj
WELCOME TO TOPHER ENGINEERICS
Enter your age please 67
please wait.....
You qualify 😊😊
kindly contact us though raphaelsarota@gmail.com, attach your cv
[Program finished]
Enter your full name please
ram
WELCOME TO TOPHER ENGINEERICS
Enter your age please 17
sorry you're young
[Program finished]
topher @ali
Anonymous
Vishwa
Anonymous
lmfaoooo
Vishwa
....
Anonymous
Anonymous
....
look at the one below
Anonymous
...
Vishwa
...
Bro before u I already send my code ,that time also my code worked
Anonymous
Anonymous
but this is C++ and we have std::string, we don't need char[x] ir whatever
Saurabh
I have coding question please help me to solve please 🙏🙏
Anonymous
Anonymous
@bindasssaurabhyo i won't help you chat your school work
Saurabh
No
Saurabh
Placement question
Anonymous
also don't DM me without telling me, that's how you get blocked
Anonymous
and the question is literally right there, just oaste it into google
Vishwa
Anonymous
Guys why we can't use some repetition ?
Nameful
Anonymous
What do you mean?
Example for while , for , we can use c programming but range we can't use c programming