Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 17:34

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C++ issue

Discussion on C++ issue within the C/C++ forum part of the Coders Den category.

Reply
 
Old 11/03/2012, 08:34   #16
 
elite*gold: 0
Join Date: Mar 2012
Posts: 30
Received Thanks: 0
can you help me please i got this code how will i convert this. given an address and offset i got this in cheat engine table. what is the meaning of 7D4 2B0 3C8
<Address>A9B820</Address>
<Offset>7D4</Offset>
<Offset>2B0</Offset>
<Offset>3C8</Offset>
audreyxp2012 is offline  
Old 11/06/2012, 16:18   #17
 
elite*gold: 0
Join Date: Nov 2012
Posts: 29
Received Thanks: 1
i think you cant do it from there
ginneg is offline  
Old 11/09/2012, 14:05   #18
 
o0Zero0o1's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 117
Received Thanks: 15
Seems the definition is a whole other story

Each point of the triangle is made up of two dots
Point A = x1,y1
Point B= x2,y2
Point C= x3,y3
like this on the pic:


Calculating the distance between these points is like:

Than finding S and P.


Now anyway when the program exe starts it should look like
Quote:
Number of Triangle you need to find S and P:
Insert data for point A
x=
y=
Insert data for point B
x=
y=
Insert data for point C
x=
y=
S= ... P =.... lala
So i need 3 values for X .... how am i going keep them separate while in structures.
o0Zero0o1 is offline  
Old 11/09/2012, 15:37   #19
 
.SkyneT.'s Avatar
 
elite*gold: 273
Join Date: Sep 2010
Posts: 1,831
Received Thanks: 786
Quote:
Originally Posted by o0Zero0o1 View Post
Seems the definition is a whole other story

Each point of the triangle is made up of two dots
Point A = x1,y1
Point B= x2,y2
Point C= x3,y3
like this on the pic:


Calculating the distance between these points is like:

Than finding S and P.


Now anyway when the program exe starts it should look like


So i need 3 values for X .... how am i going keep them separate while in structures.
Code:
struct _Coordinate
{
     float x;
     float y;
};

int main()
{
	_Coordinate 
		A = {0.0, 0.0}, 
		B = {0.0, 0.0}, 
		C = {0.0, 0.0}; //Declare and initalize 3 "points" 

	std::cout << "Point A:" << std::endl << "X = ";
	std::cin >> A.x; //save input to x coordinate of A
	std::cout << "Y = ";
	std::cin >> A.y; //save input to y coordinate of A

	std::cout << "X1 = " << A.x << std::endl
		  << "Y1 = " << A.y << std::endl;

	return 0;
}
.SkyneT. is offline  
Thanks
1 User
Old 11/10/2012, 15:05   #20
 
o0Zero0o1's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 117
Received Thanks: 15
I have to use structures for both point and triangle so ....it has to be somehting like

Code:
#include<iostream.h>
#include<math.h>

struct Coordinate
{
float x;
float y;
};
struct Triangle
{
Point A;
Point B;
Point C;
};
int main{
cout<<"Point A \n x="
cin>> coordinate.x;
cout<<"Point A\n y="
cin>> coordinate.y;
cout<<"Point B \n x="
cin>> coordinate.x;
cout<<"Point B\n y="
cin>> coordinate.y;
cout<<"Point C \n x="
cin>> coordinate.x;
cout<<"Point C\n y="
cin>> coordinate.y;
Triangle.PointA = {coordinate.x , coordinate.y} // the ones we input for A
Triangle.PointB = {coordinate.x , coordinate.y} // for b ....
Triangle.PointC = {coordinate.x , coordinate.y} // for c .... 
---->// But how will the structures get 3 valeus for X and 3 for Y , won't it just over write them?

Side A = [img]http://img355.imageshack.us/img355/4259/image008yk1.jpg[/img]
//so on for the rest 2 sides

P = Side A + Side B + Side C
p = P/2
S = p //// heron's formula

cout<<"P=" <<P;
Cout<<"S="<< S;
return 0;
}
Something like this ... but it just wont work .... also need to input cycle with FOR for 'N' triangles ( N - unknown number that is being input upon program execution)
o0Zero0o1 is offline  
Old 11/10/2012, 19:10   #21
 
.SkyneT.'s Avatar
 
elite*gold: 273
Join Date: Sep 2010
Posts: 1,831
Received Thanks: 786
Code:
struct _Coordinate
{
   float x;
   float y;
};

struct Triangle
{
   _Coordinate A;
   _Coordinate B;
   _Coordinate C;
};

int main()
{
   Triangle triangle = 
   {
      0.0, 0.0, //Ax, Ay
      0.0, 1.0, //Bx, By
      0.0, 0.0  //Cx, Cy
   };
}
Thats how to declare and initalize.
You can access every Value with "triangle.Point.Coordinate".
e.g: triangle.B.y //would be 1.0 here

To let the user put in 'n' triangles, just make a loop.
(this shouldn't be a problem or ? )

Btw: To calculate a sqare root just use "sqrt()".
.SkyneT. is offline  
Thanks
1 User
Old 11/11/2012, 08:27   #22
 
o0Zero0o1's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 117
Received Thanks: 15
The coffe is heating up ... let's see what am i going to do

Code:
#include<iostream.h>
#include<math.h>
struct _Coordinate
{
   float x;
   float y;
};

struct Triangle
{
   _Coordinate A;
   _Coordinate B;
   _Coordinate C;
};

int main()
{
	int K,i;
	float S,P,p,Side_A,Side_B,Side_C;

	cout<<"Number of Triangles = " ;
	cin>>K;
	for (i=0;i<K;i++)
	{
        cout<<"Coordinates regarding A="<<endl << "X = ";
			cin>>Triangle.A.x;
		cout<<"Coordinates regarding A="<<endl << "Y = ";
			cin>>Triangle.A.y;
		cout<<"Coordinates regarding B="<<endl << "X = ";
			cin>>Triangle.B.x;
		cout<<"Coordinates regarding B="<<endl << "Y = ";
			cin>>Triangle.B.y;
		cout<<"Coordinates regarding B="<<endl << "X = ";
			cin>>Triangle.C.x;
		cout<<"Coordinates regarding C="<<endl << "Y = ";
			cin>>Triangle.C.y;
		Side_A = sqrt( (Triangle.C.x*Triangle.C.x)-(2*Triangle.B.x*Triangle.C.x)+(Triangle.B.x*Triangle.B.x)+(Triangle.C.y*Triangle.C.y)-(2*Triangle.B.y*Triangle.C.y)+(Triangle.B.y*Triangle.B.y));
		Side_B = sqrt( (Triangle.A.x*Triangle.A.x)-(2*Triangle.C.x*Triangle.A.x)+(Triangle.C.x*Triangle.C.x)+(Triangle.A.y*Triangle.A.y)-(2*Triangle.C.y*Triangle.A.y)+(Triangle.C.y*Triangle.C.y));
		Side_C = sqrt( (Triangle.B.x*Triangle.B.x)-(2*Triangle.B.x*Triangle.A.x)+(Triangle.A.x*Triangle.A.x)+(Triangle.B.y*Triangle.B.y)-(2*Triangle.A.y*Triangle.B.y)+(Triangle.A.y*Triangle.A.y));
	
	
	P = Side_A+Side_B+Side_C; //perimeter
	p = P/2; //semiperimeter needed for the Heron's formula
	S = sqrt(p(p-Side_A)(p-Side_B)(p-Side_C) ); //Heron's formula for finding the area

	cout<<"\n The perimeter is = " <<P;
	cout<<"\n The are is = " <<S;
	cout<<endl;
	}
	return 0;
	
	
	
}

Cool ... it's like 19errors in the Visual C++ ... can't even understand the errors : |.The loop will work it is just that i have no idea how for example to put the outgoing data regarding each triangle , like :
Number of triangles: 7
..... data inpuiting ....
...calculations .....
output:
Triangle
1 ....
2....
3...
o0Zero0o1 is offline  
Old 11/11/2012, 14:52   #23
 
.SkyneT.'s Avatar
 
elite*gold: 273
Join Date: Sep 2010
Posts: 1,831
Received Thanks: 786
Quote:
Originally Posted by o0Zero0o1 View Post
The coffe is heating up ... let's see what am i going to do

Code:
#include<iostream.h>
#include<math.h>
struct _Coordinate
{
   float x;
   float y;
};

struct Triangle
{
   _Coordinate A;
   _Coordinate B;
   _Coordinate C;
};

int main()
{
	int K,i;
	float S,P,p,Side_A,Side_B,Side_C;

	cout<<"Number of Triangles = " ;
	cin>>K;
	for (i=0;i<K;i++)
	{
        cout<<"Coordinates regarding A="<<endl << "X = ";
			cin>>Triangle.A.x;
		cout<<"Coordinates regarding A="<<endl << "Y = ";
			cin>>Triangle.A.y;
		cout<<"Coordinates regarding B="<<endl << "X = ";
			cin>>Triangle.B.x;
		cout<<"Coordinates regarding B="<<endl << "Y = ";
			cin>>Triangle.B.y;
		cout<<"Coordinates regarding B="<<endl << "X = ";
			cin>>Triangle.C.x;
		cout<<"Coordinates regarding C="<<endl << "Y = ";
			cin>>Triangle.C.y;
		Side_A = sqrt( (Triangle.C.x*Triangle.C.x)-(2*Triangle.B.x*Triangle.C.x)+(Triangle.B.x*Triangle.B.x)+(Triangle.C.y*Triangle.C.y)-(2*Triangle.B.y*Triangle.C.y)+(Triangle.B.y*Triangle.B.y));
		Side_B = sqrt( (Triangle.A.x*Triangle.A.x)-(2*Triangle.C.x*Triangle.A.x)+(Triangle.C.x*Triangle.C.x)+(Triangle.A.y*Triangle.A.y)-(2*Triangle.C.y*Triangle.A.y)+(Triangle.C.y*Triangle.C.y));
		Side_C = sqrt( (Triangle.B.x*Triangle.B.x)-(2*Triangle.B.x*Triangle.A.x)+(Triangle.A.x*Triangle.A.x)+(Triangle.B.y*Triangle.B.y)-(2*Triangle.A.y*Triangle.B.y)+(Triangle.A.y*Triangle.A.y));
	
	
	P = Side_A+Side_B+Side_C; //perimeter
	p = P/2; //semiperimeter needed for the Heron's formula
	S = sqrt(p(p-Side_A)(p-Side_B)(p-Side_C) ); //Heron's formula for finding the area

	cout<<"\n The perimeter is = " <<P;
	cout<<"\n The are is = " <<S;
	cout<<endl;
	}
	return 0;
	
	
	
}

Cool ... it's like 19errors in the Visual C++ ... can't even understand the errors : |.The loop will work it is just that i have no idea how for example to put the outgoing data regarding each triangle , like :
Number of triangles: 7
..... data inpuiting ....
...calculations .....
output:
Triangle
1 ....
2....
3...
Ok i should repeat it a little bit different:
"you HAVE TO declare and initalize the stuff"

Just use the struct like int or float.
Code:
   Triangle nomatterwhatnamethishas = 
   {
      0.0, 0.0, //Ax, Ay
      0.0, 0.0, //Bx, By
      0.0, 0.0  //Cx, Cy
   };
Then you access like that:
Code:
nomatterwhatnamethishas.A.x
Or save a value:
Code:
nomatterwhatnamethishas.A.x = 10
Or use cin:
Code:
std::cin >> nomatterwhatnamethishas.A.x
But this all will only work if you declared "nomatterwhatnamethishas" before.
Without declaration and using Triangle.A.x, it will never work!
.SkyneT. is offline  
Thanks
1 User
Old 11/11/2012, 15:57   #24
 
o0Zero0o1's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 117
Received Thanks: 15
Retard here <

And yes it actually work and i just got this now:
Code:
#include<iostream.h>
#include<math.h>
struct _Coordinate
{
   float x;
   float y;
};

struct _Triangle
{
   _Coordinate A;
   _Coordinate B;
   _Coordinate C;
};

int main()
{
	_Triangle Triangle ;
	int K,i;
	float S,P,p,Side_A,Side_B,Side_C;

	cout<<"Number of Triangles = " ;
	cin>>K;
	for (i=0;i<K;i++)
	{
        cout<<"Coordinates regarding A="<<endl << "X = ";
			cin>>Triangle.A.x;
		cout<<"Coordinates regarding A="<<endl << "Y = ";
			cin>>Triangle.A.y;
		cout<<"Coordinates regarding B="<<endl << "X = ";
			cin>>Triangle.B.x;
		cout<<"Coordinates regarding B="<<endl << "Y = ";
			cin>>Triangle.B.y;
		cout<<"Coordinates regarding B="<<endl << "X = ";
			cin>>Triangle.C.x;
		cout<<"Coordinates regarding C="<<endl << "Y = ";
			cin>>Triangle.C.y;
		Side_A = sqrt((Triangle.C.x*Triangle.C.x)-(2*Triangle.B.x*Triangle.C.x)+(Triangle.B.x*Triangle.B.x)+(Triangle.C.y*Triangle.C.y)-(2*Triangle.B.y*Triangle.C.y)+(Triangle.B.y*Triangle.B.y));
		Side_B = sqrt((Triangle.A.x*Triangle.A.x)-(2*Triangle.C.x*Triangle.A.x)+(Triangle.C.x*Triangle.C.x)+(Triangle.A.y*Triangle.A.y)-(2*Triangle.C.y*Triangle.A.y)+(Triangle.C.y*Triangle.C.y));
		Side_C = sqrt((Triangle.B.x*Triangle.B.x)-(2*Triangle.B.x*Triangle.A.x)+(Triangle.A.x*Triangle.A.x)+(Triangle.B.y*Triangle.B.y)-(2*Triangle.A.y*Triangle.B.y)+(Triangle.A.y*Triangle.A.y));
	
	
	P = Side_A+Side_B+Side_C; 
	p = P/2; 
	S=sqrt(p*(p-Side_A)*(p-Side_B)*(p-Side_C));

	cout<<"\n The perimeter of triangle ["<<i<<"] = " <<P;
	cout<<"\n The are of triangle ["<<i<<"] = " <<S;
	cout<<endl;
	};
	return 0;
	
	
	
}

--------------------Configuration: dasda - Win32 Debug--------------------
Compiling...
aaaaaa.cpp
d:\program files\microsoft visual studio\myprojects\dasda\aaaaaa.cpp(38) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
d:\program files\microsoft visual studio\myprojects\dasda\aaaaaa.cpp(39) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
d:\program files\microsoft visual studio\myprojects\dasda\aaaaaa.cpp(40) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
d:\program files\microsoft visual studio\myprojects\dasda\aaaaaa.cpp(45) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data

aaaaaa.obj - 0 error(s), 4 warning(s)
It works just no clue how come this conversions form double to float?I didn't set anything to double,unless these were by default?

EDIT: Switched variables type to double , all cool ... 0/0
o0Zero0o1 is offline  
Old 11/16/2012, 13:58   #25
 
o0Zero0o1's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 117
Received Thanks: 15
Now my teach said i'm on the right way it's just that i need to use massive ... all he gave me as hint was ... you will access the structures through the massive like

struct trio[N]
or trio[N].A.x
trio[N].A.y
.... so on .... any idea on that? -_-
o0Zero0o1 is offline  
Old 11/23/2012, 17:23   #26
 
o0Zero0o1's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 117
Received Thanks: 15
One more question (bumping this thread to avoid starting new one)

Do you know the way to convert a C++ code into flowchart diagram in Microsoft Visio?
o0Zero0o1 is offline  
Reply


Similar Threads Similar Threads
Little issue
10/13/2011 - Dekaron Private Server - 4 Replies
Ladies and Gentlemen, i have a little and noob Problem. I Downloaded the Aloken server files with the Dekaronserver.exe, Dekaron.exe and the character.bak (ItsNobody database). I placed the dekaronserver.exe in the appropriate folder inside the virtual machine. I placed the dekaron.exe in the appropriate folder inside the A9 client. What i should do with the character.bak? i know it is something to do into databese, but i really dont know how i should start. Can someone tell me...
Issue with DB-Bot
07/14/2010 - SRO Private Server - 3 Replies
Hello, when I add a new skill in the bot or when I update a skill it always says: the selected item cannot be used together or the skill is already in use. But the old skill is gone in the game and in the bot but still it says that.. Really frustrating I play on ZSZC sro...
AC/Bot issue
07/15/2008 - MapleStory - 0 Replies
i have tryed many ac/bot that woked for many ppl but it doesn't for me. I download the ac/bot annd folo the intruction completly. i start up the ac/bot and then run my private server. in the server i click the hotkey but nothing happenes. it says the ac is enable but nothing happens. help me plz i'm really getting frustrated.
SV Issue
11/18/2007 - Conquer Online 2 - 7 Replies
Basically after i press start sv just does nothing apart from hop around a bit now and again. On co there is a msg 'can't jump that far' dont know if that has anything to do with it. sv was working fine before, then it did this and when i tried the next day it worked for some reason, now it wont work again. fyi im using sv 1.17 with ce on patch 4356, help very much appreciated as i have tried everything including fresh co install.



All times are GMT +2. The time now is 17:34.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.