Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,884 members, 7,828,142 topics. Date: Wednesday, 15 May 2024 at 02:45 AM

Plz Can Anyone Solve This Using C++? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Plz Can Anyone Solve This Using C++? (2356 Views)

How Do I Get A Value From Another Form Using C#.NET 2008 / I Need Help On Oop Project Using C# Console-base Application / An Introduction To Programming Using C (2) (3) (4)

(1) (Reply) (Go Down)

Plz Can Anyone Solve This Using C++? by callydon(m): 10:57pm On Apr 26, 2012
Plz am a computer science student of ANSU n we were given dis assignment to write dis program using C++. The program is dis
"The sum of the length of any two sides of a triangle is greater than d length of the third side, write a program to input three lengths then tell whether or not they could be length of side of a triangle."
plz guys dis assignment wud be submitted tomorrow,so d sooner d better.
Thanks y'all.
Re: Plz Can Anyone Solve This Using C++? by callydon(m): 11:06pm On Apr 26, 2012
Guys am still waiting 4d code for d program using C++ programming language.
Thanks once again.
Re: Plz Can Anyone Solve This Using C++? by Kobojunkie: 11:40pm On Apr 26, 2012
Well, how about we start with what you have already written. Tell us what the error message is, and we can help you figure out how to solve it.
Re: Plz Can Anyone Solve This Using C++? by Beaf: 11:47pm On Apr 26, 2012
callydon: Plz am a computer science student of ANSU n we were given dis assignment to write dis program using C++. The program is dis
"The sum of the length of any two sides of a triangle is greater than d length of the third side, write a program to input three lengths then tell whether or not they could be length of side of a triangle."
plz guys dis assignment wud be submitted tomorrow,so d sooner d better.
Thanks y'all.
All you have to do is check that all combos of two sides a greater than the 3rd. What could be simpler?
You've not even attempted to write any code for such asimple problem! angry
Why are you studying Computer Science? What for? angry angry angry

Better take up history, religion or something else thats absolutely non-technical.

1 Like

Re: Plz Can Anyone Solve This Using C++? by lordZOUGA(m): 11:57pm On Apr 26, 2012
I want to believe this was a mistake
Re: Plz Can Anyone Solve This Using C++? by escobar07(m): 1:24am On Apr 27, 2012
its pretty simple. I wont write out d code. I'll just give u a short pseudocode-like explanation.here is it: since u knw d conditions dat must be true for a triangle to be formed. Use a nested if ... Else statement to test for all combinations of the 3 integers. Each if statement should test whether d sum of a particular combo of 2 of d ints gives a value less than d 3rd int. D else part shld test nothing as usual. D else part shld print 'possible' and the other parts shld print 'not possible' or whateva u feel is approriate in each.
Re: Plz Can Anyone Solve This Using C++? by Nobody: 6:27am On Apr 27, 2012
Re: Plz Can Anyone Solve This Using C++? by callydon(m): 12:34pm On Apr 27, 2012
Beaf:
All you have to do is check that all combos of two sides a greater than the 3rd. What could be simpler?
You've not even attempted to write any code for such asimple problem! angry
Why are you studying Computer Science? What for? angry angry angry

Better take up history, religion or something else thats absolutely non-technical.
@Beef. 4rm ur name,it shows dat U are jst hia to look for trouble. Dat said,I dn't av time to banter words wit U.
Re: Plz Can Anyone Solve This Using C++? by lordZOUGA(m): 1:52pm On Apr 27, 2012
callydon:
@Beef. 4rm ur name,it shows dat U are jst hia to look for trouble. Dat said,I dn't av time to banter words wit U.
he was being sincere dude... Attempt figuring out the algorithm first. Then post it. Then I will tell myself you didn't know it cos u are new to C++ language.
Re: Plz Can Anyone Solve This Using C++? by AZeD1(m): 4:58pm On Apr 27, 2012
dude firstly do you know any programming language? If yes, the solve it in your favorite programming language and transcribe to C++.
If you don't know nay programming language, then this should spur you to learn one.
That said
Input == 3 integers x, y, z
operation == check if (X+y)> z or (x+z)>y or (y+z)> x
Output == return true if any of operation == true.
Re: Plz Can Anyone Solve This Using C++? by callydon(m): 9:30pm On Apr 27, 2012
escobar07: its pretty simple. I wont write out d code. I'll just give u a short pseudocode-like explanation.here is it: since u knw d conditions dat must be true for a triangle to be formed. Use a nested if ... Else statement to test for all combinations of the 3 integers. Each if statement should test whether d sum of a particular combo of 2 of d ints gives a value less than d 3rd int. D else part shld test nothing as usual. D else part shld print 'possible' and the other parts shld print 'not possible' or whateva u feel is approriate in each.
bros all I need 4rm U is jst d SYNTAX n I'll do d remaining.
@all other posters who av being bleeping their mouths,U al knw d Nigerian University system. No program is actually thought,n hia I am trying to learn n some guys who think they now knw it all are running their mouths...
Jst one sentence for y'all, "Rem U started 4rm somewhere"
Re: Plz Can Anyone Solve This Using C++? by escobar07(m): 1:05am On Apr 28, 2012
#include <iostream> using std::cout;
using std::cin;
using std::endl;

int main()
{
int num1;
int num2;
int num3;
cout<< "pls enter 1st
no";
cin>> num1;

cout<< "pls enta 2nd no";
cin>> num2;

cout<< "pls enta 3rd no";
cin>> num3;

if( num1 + num2 <= num3)
cout<< "they cant be sides of a triangle";

else if(num2 + num3 <= num1)
cout<<"they cant be sides of a triangle";

else if (num1+num3 <= num2)
cout<<"they cant be sides of a triangle";

else
cout<<" they can be sides of a triangle";

cout<<endl;

return 0;
}
this is it. Try to put comments. They could fetch u marks. Pls try and get ur hands dirty, no lecturer will go deep. Some may nt even have a deep knowledge of it. Get urself a good text and i want to believe u have a system. Goodluck.
Re: Plz Can Anyone Solve This Using C++? by callydon(m): 7:41am On Apr 28, 2012
@escobar07. Thanks soooo much.
@all other posters. U can now see dat its actually EASIER to HELP than to CRITICISE.

1 Like

Re: Plz Can Anyone Solve This Using C++? by lordZOUGA(m): 7:59am On Apr 28, 2012
that ^^^ is not help
Re: Plz Can Anyone Solve This Using C++? by 8figure(m): 11:48am On Apr 28, 2012
callydon: @escobar07. Thanks soooo much.
@all other posters. U can now see dat its actually EASIER to HELP than to CRITICISE.


Boy I can see ur really happy with that spoon in your mouth.

Your own don finish if that's the case
Re: Plz Can Anyone Solve This Using C++? by 8figure(m): 11:56am On Apr 28, 2012
Now here I have a little problem here.

I need help with this code.
just read the comments


I tried writing blah and it was undefined and also it seems it must get its value after confirmpass have got its own value from form input.

I need clue on writing the value of blah and confirmpass
just little hint, I don't need spoon oo!!!
grin callydon lipsrsealed

Re: Plz Can Anyone Solve This Using C++? by lordZOUGA(m): 2:24pm On Apr 28, 2012
@8figure, why don't you give an overall description about wat u are trying to do.. Your comments are not as descriptive as you think and Please would you mind being more creative in naming ur variables...
In line 28: what you did was assign the value of 'base' to 'pass' if the expression on the left evaluates to true.. Is that what u want? Cos the comment on that line says different
Re: Plz Can Anyone Solve This Using C++? by 8figure(m): 3:20pm On Apr 28, 2012
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int num1,num2,num3;
cout<< "please enter 1st number: ";
cin>> num1;
cout<< "please enter 2nd number: ";
cin>> num2;
cout<< "please enter 3rd number: ";
cin>> num3;
if( (num1 + num2 <= num3)||(num2 + num3 <= num1)||(num1+num3 <= num2))
cout<< "they cant be sides of a triangle"<<endl;

else
cout<<"Number1 + number2 + number3 ="<<num1+num2+num3<<endl;
cout<< "they can be sides of a triangle"<<endl;



/*
int result=num1+num2+num3;
switch(result)
{
case (num1+num2>num3):
cout<<"number1 + number2 is greater than number 3"<<endl;
cout<<"so they can be sides of a triangle"<<endl;
break;
case (num1+num3>num2):
cout<<"number1 + number3 is greater than number 2"<<endl;
cout<<"so they can be sides of a triangle"<<endl;
break;
case (num2 + num3 > num1):
cout<<"number2 + number3 is greater than number 1"<<endl;
cout<<"so they can be sides of a triangle"<<endl;
break;
default:
cout<<"sorry the can't be triangle"
}
*/

cout<<endl;
getchar();getchar();
return 0;
}





That's my little modification of the above prog, no debugging needed, just copy paste and compile thats all,


but wait, I tried to do it with switch statement but don't know how to parse the expression instead of value of result.

`numx' cannot appear in a constant-expression
was the compilers error
Re: Plz Can Anyone Solve This Using C++? by 8figure(m): 3:38pm On Apr 28, 2012
lordZOUGA: @8figure, why don't you give an overall description about wat u are trying to do.. Your comments are not as descriptive as you think and Please would you mind being more creative in naming ur variables...
In line 28: what you did was assign the value of 'base' to 'pass' if the expression on the left evaluates to true.. Is that what u want? Cos the comment on that line says different




<script language="JavaScript">
function checkPass()
{
var p1 = "bewareoftheenigmagroupunderground";
var p2 = "betterofftohacktherealownersboxes";
var p3 = "wassaidbyadudepseudodpsychomarine";
var confirmPass = document.login.password.value;//here i need the value of confirmpass
var chk0 = 0;
var pass = "";
var base = "";
for ( a = 0; a < p1.length; ++a )
{
var blah = confirmPass.substring ( chk0, chk0 + 1 );//all i want here is the value of blah
var chk1 = p1.substring ( a, a + 1 );
var chk2 = p2.substring ( a, a + 1 );
var chk3 = p3.substring ( a, a + 1 );
if ( chk1 == chk3 ) { if ( chk1 == blah) { base = base + chk1; } else { break; } chk0++; }
if ( chk2 == chk1 ) { if ( chk2 == blah) { base = base + chk2; } else { break; } chk0++; }
if ( chk3 == chk2 ) { if ( chk3 == blah) { base = base + chk3; } else { break; } chk0++; }
( p1.length == a + 1 ) ? pass = base : false;/*meant if expression inside () is true execute the immidiate expression, else false.*/
}
( confirmPass != '' && confirmPass == pass ) ? window.location.href=pass+".php" : alert( "Wrong! Please try again." );
}
</script>



<form id="login" method="post" action="" name="login">
Password:
<input id="password" type="password" maxlength="30" size="30" value="" name="password">
<input id="submit" type="button" onclick="checkPass()" value="Click to Login" name="submit">
</form>


when I have the values of the commented parts, am done with other stuffs.

@lordZOUGA

am just trying to know the password that is supposed to be accepted in the form.
NOTA BENe: am not asking you to solve any other part outside the commented parts


thanks for your concern.





Re: Plz Can Anyone Solve This Using C++? by escobar07(m): 5:32pm On Apr 28, 2012
@8figure.
I want to believe u were trying to reproduce wat u quoted using a switch statement. If yes, u got it wrong.
Each of ur case expressions must evaluate to a constant integer value and each term in d expression must be a character constant or an integer constant. U could have 3, 3+4,'b' + 3, 's'etc.
Ur case labels evaluate to a bool values!
Re: Plz Can Anyone Solve This Using C++? by escobar07(m): 5:33pm On Apr 28, 2012
@8figure.
I want to believe u were trying to reproduce wat u quoted using a switch statement. If yes, u got it wrong.
Each of ur case expressions must evaluate to a constant integer value and each term in d expression must be a character constant or an integer constant. We could have 3, 3+4,'b' + 3, 's'etc.
Ur case labels evaluate to bool values!
Re: Plz Can Anyone Solve This Using C++? by 8figure(m): 9:50am On Apr 29, 2012
Guys no reply on the javascript code yet?
Just a hint no spoon...
Re: Plz Can Anyone Solve This Using C++? by 8figure(m): 4:05pm On Apr 30, 2012
[size=20pt]I think this programming section is not impressive/active at all, as for the javascript task, I've figured it out and done what I needed.[/size]

No thanks to you guyz at all
Re: Plz Can Anyone Solve This Using C++? by lekside44(m): 2:59pm On May 13, 2012
you need to understand the mathematics first?

(1) (Reply)

Simple CRUD Application In PHP And Mysql / Java Game Programming / Aren't There Any C++ Devs On This Section Or Programmers That Do Complex Stuff?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 45
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.