I need help as i m new in C++

X

Xohaib

Hi! every one i am new in c, c++ i have just started it... i mean to
say that i have jsut learnt to include iostream and how to use if
condition, and cin, and cout but with the help of different sites i
have leartn how to use for loop.... but i am not perfect....

The thing over here i want to say is that give me the assignment to
make different programms like ask me to make a program that takes a
number as input from user and make table of it..... Is it interesting
game na...... yes.



So what are you waiting for? ask me the programs which are made bye
using if and OR gate AND gate and cin,cout as i am working in VC 6.0.
So are u agree.........



LETS play it ...............
 
I

Ioannis Gyftos

Hi! every one i am new in c, c++ i have just started it... i mean to
say that i have jsut learnt to include iostream and how to use if
condition, and cin, and cout but with the help of different sites i
have leartn how to use for loop.... but i am not perfect....

The thing over here i want to say is that give me the assignment to
make different programms like ask me to make a program that takes a
number as input from user and make table of it..... Is it interesting
game na...... yes.

So what are you waiting for? ask me the programs which are made bye
using if and OR gate AND gate and cin,cout as i am working in VC 6.0.
So are u agree.........

LETS play it ...............

Calculate the first X prime numbers, where X is input from the user.
 
A

anon

Xohaib said:
Hi! every one i am new in c, c++ i have just started it... i mean to
say that i have jsut learnt to include iostream and how to use if
condition, and cin, and cout but with the help of different sites i
have leartn how to use for loop.... but i am not perfect....

The thing over here i want to say is that give me the assignment to
make different programms like ask me to make a program that takes a
number as input from user and make table of it..... Is it interesting
game na...... yes.



So what are you waiting for? ask me the programs which are made bye
using if and OR gate AND gate and cin,cout as i am working in VC 6.0.
So are u agree.........



LETS play it ...............

Cool, go make me a nice robot, or a locomotive... or something
 
G

Guest

Hi! every one i am new in c, c++ i have just started it... i mean to

First of you should be clear about the fact that C and C++ are two
different languages. While they might look quite similar and in many
ways are quite similar there are many things which are *not* similar.
say that i have jsut learnt to include iostream and how to use if
condition, and cin, and cout but with the help of different sites i
have leartn how to use for loop.... but i am not perfect....

The thing over here i want to say is that give me the assignment to
make different programms like ask me to make a program that takes a
number as input from user and make table of it..... Is it interesting
game na...... yes.

If you want to learn C++ you *must* have a book, I have yet to see any
good sites or collection of sites for learning C++. Any decent book
teaching C++ will come with exercises suitable for what you have learned
so far which is much better than us trying to figure out what you know
and do not know (provided that we would agree to spend our time with
coming up with exercises for you).

Books often recommended to beginners include "Accelerated C++" by
Koening and Moo, and "C++ Primer 4th ed." by Lippman, Lajoie, and Moo.
More books reviews can be found on ACCU's site:
http://www.accu.org/index.php/book_reviews?url=search.xqy?x&term=beginner's+c++&field=subject
as i am working in VC 6.0.


VC++ 6 is a very old IDE, predating the C++ standard and will not
compile some correct C++ programs. I would recommend that you use
something newer. VC++ 2005 Express can be downloaded from MS's site for
free, other people like CodeBlocks.
 
J

Jim Langston

Xohaib said:
Hi! every one i am new in c, c++ i have just started it... i mean to
say that i have jsut learnt to include iostream and how to use if
condition, and cin, and cout but with the help of different sites i
have leartn how to use for loop.... but i am not perfect....

The thing over here i want to say is that give me the assignment to
make different programms like ask me to make a program that takes a
number as input from user and make table of it..... Is it interesting
game na...... yes.



So what are you waiting for? ask me the programs which are made bye
using if and OR gate AND gate and cin,cout as i am working in VC 6.0.
So are u agree.........

LETS play it ...............

First off, get rid of VC 6.0. It was made pre-standard and somethings are
just not quite right about it. You can download VC++ express 2005 for free
from microsoft that is more standard compliant.
http://msdn2.microsoft.com/en-us/express/aa700735.aspx
 
S

Stephan Rose

Hi! every one i am new in c, c++ i have just started it... i mean to say
that i have jsut learnt to include iostream and how to use if condition,
and cin, and cout but with the help of different sites i have leartn how
to use for loop.... but i am not perfect....

The thing over here i want to say is that give me the assignment to make
different programms like ask me to make a program that takes a number as
input from user and make table of it..... Is it interesting game
na...... yes.



So what are you waiting for? ask me the programs which are made bye
using if and OR gate AND gate and cin,cout as i am working in VC 6.0.
So are u agree.........



LETS play it ...............

Given two arbitrary non-self intersecting shapes defined by line and
elliptic curve segments, find the minimum distance between the two.

Now go have fun ;)

--
Stephan
2003 Yamaha R6

å›ã®ã“ã¨æ€ã„出ã™æ—¥ãªã‚“ã¦ãªã„ã®ã¯
å›ã®ã“ã¨å¿˜ã‚ŒãŸã¨ããŒãªã„ã‹ã‚‰
 
K

Kira Yamato

Given two arbitrary non-self intersecting shapes defined by line and
elliptic curve segments, find the minimum distance between the two.

Now go have fun ;)

Over projective space or affine? Is the base field real, complex or
just rational?

:)
 
J

Jim Langston

Kira Yamato said:
Over projective space or affine? Is the base field real, complex or just
rational?

:)

Here's one that someone in some programming newsgroup was asking.

Given a circle and a square of arbitrary size and positions, how can you
tell when they overlap in code?

Incidently, no one every did come up with a solution, so you'll need to
wrack your analytical brain for this one. I could probably come up with a
way, but I have my own 3D math things I need to work on.
 
S

Stephan Rose

Here's one that someone in some programming newsgroup was asking.

Given a circle and a square of arbitrary size and positions, how can you
tell when they overlap in code?

Incidently, no one every did come up with a solution, so you'll need to
wrack your analytical brain for this one. I could probably come up with
a way, but I have my own 3D math things I need to work on.

Well a circle and a square imply 2 dimensions. That one is easy to solve,
I can do that in my sleep.

They will overlap under either of the following 2 conditions:

- Distance from circle center to any one of the 4 corner points of the
square is less than the radius of the circle.

- Distance from circle center to any of the 4 line segment (point->line
distance, easy to calculate) is less than the radius of the circle.

Come to think of it, the exact same actually applies to 3 dimensional
space.

If you have a cube, if the distance between any one of it's edge points
is less than the radius of the sphere, they are penetrating.

Or, if the distance between any one of the perpendicular vectors of the 6
planes (point->plane distance) is less than the radius of the sphere they
are again intersecting.

It's when you have to deal with ellipses where it gets interesting. I've
yet to find a non-recursive method.

--
Stephan
2003 Yamaha R6

å›ã®ã“ã¨æ€ã„出ã™æ—¥ãªã‚“ã¦ãªã„ã®ã¯
å›ã®ã“ã¨å¿˜ã‚ŒãŸã¨ããŒãªã„ã‹ã‚‰
 
S

Stephan Rose

Over projective space or affine? Is the base field real, complex or
just rational?

:)

Just on a 2D Cartesian coordinate system.

Nothing fancy! =)

--
Stephan
2003 Yamaha R6

å›ã®ã“ã¨æ€ã„出ã™æ—¥ãªã‚“ã¦ãªã„ã®ã¯
å›ã®ã“ã¨å¿˜ã‚ŒãŸã¨ããŒãªã„ã‹ã‚‰
 
S

Stephan Rose

Well a circle and a square imply 2 dimensions. That one is easy to
solve, I can do that in my sleep.

They will overlap under either of the following 2 conditions:

- Distance from circle center to any one of the 4 corner points of the
square is less than the radius of the circle.

- Distance from circle center to any of the 4 line segment (point->line
distance, easy to calculate) is less than the radius of the circle.

Come to think of it, the exact same actually applies to 3 dimensional
space.

If you have a cube, if the distance between any one of it's edge points
is less than the radius of the sphere, they are penetrating.

Or, if the distance between any one of the perpendicular vectors of the
6 planes (point->plane distance) is less than the radius of the sphere
they are again intersecting.

I actually just realized there is an additional problem in 3 dimensional
space. The test can produce false positives if one of the cube planes
intersects the sphere but the cube is physically outside the sphere.

So in the sphere center->cube plane test, the vector has to be
constrained so that it's intersection point is on the actual face on the
cube. If the perpendicular vector of the plane doesn't result in an
intersection on the cube face, then the edges of the face have to be
tested instead making it a 3d line to point test.

That though should then be watertight I think.

Come to think of it, one could probably just simply all that to a point -
triangle distance test. Break the cube down into triangles and test
each triangle against the center point of the sphere. Done. That is
definitely watertight.

That's essentially what I do in my 2 dimensional case. I don't even
bother testing for box end points inside my circle. My line->point
distance calculator can automatically pick the appropriate end point if
the intersection point between the perpendicular vector of the line to
the point is found to be outside of the segment. So that gives me the
endpoint to line test, if necessary, for free.

--
Stephan
2003 Yamaha R6

å›ã®ã“ã¨æ€ã„出ã™æ—¥ãªã‚“ã¦ãªã„ã®ã¯
å›ã®ã“ã¨å¿˜ã‚ŒãŸã¨ããŒãªã„ã‹ã‚‰
 
K

Kira Yamato

Well a circle and a square imply 2 dimensions. That one is easy to solve,
I can do that in my sleep.

They will overlap under either of the following 2 conditions:

- Distance from circle center to any one of the 4 corner points of the
square is less than the radius of the circle.

- Distance from circle center to any of the 4 line segment (point->line
distance, easy to calculate) is less than the radius of the circle.

This will work only if by overlapping he meant overlapping of the
boundary only. However, if the interior of the square and circle is
taking into account, you can imagine a very small circle inside a large
square would not be detected.

Of course, it's easy to detected this case. Just check the coordinate
of the center of the circle against the coordinates of the corners of
the square.
Come to think of it, the exact same actually applies to 3 dimensional
space.

If you have a cube, if the distance between any one of it's edge points
is less than the radius of the sphere, they are penetrating.

Or, if the distance between any one of the perpendicular vectors of the 6
planes (point->plane distance) is less than the radius of the sphere they
are again intersecting.

It's when you have to deal with ellipses where it gets interesting. I've
yet to find a non-recursive method.

For the ellipse, just scale one dimension of the space so that the
ellipse becomes a circle.

Of course, all of this talk ignores the numerical inaccuracy of
floating point arithematics. So, I suppose Jim's question hasn't
really been answered yet. How do you write code on a digital machine
that does this correctly.
 
K

Kira Yamato

Just on a 2D Cartesian coordinate system.

Ok. So you want the affine case.
Nothing fancy! =)

Actually, it is in the affine case with a non-algebraically-closed
field that is the fancy case.

In the projective case over an algebraically-closed field such as the
complex numbers, the answer is always zero. This is the result by
Bezout's theorem.

But even in the affine case, it is still tractable, at least
qualitatively. You just have to prepare to do some algebraic geometry
and lots of commutative algebra. I believe there're some algebra
computer systems that can handle some commutative algebra computation.
 
S

Stephan Rose

This will work only if by overlapping he meant overlapping of the
boundary only. However, if the interior of the square and circle is
taking into account, you can imagine a very small circle inside a large
square would not be detected.

Of course, it's easy to detected this case. Just check the coordinate
of the center of the circle against the coordinates of the corners of
the square.

Good catch, I forgot that one. Probably because I'm only worried about
distances or intersections between boundaries in my own code. If I have
boundaries fully contained within another then that's ok as long as they
don't violate a certain minimum distance.
For the ellipse, just scale one dimension of the space so that the
ellipse becomes a circle.

Ok why didn't I think of this? Seriously, that's got to be the most
logical and simple way to solve that. Thanks for giving me the much
needed nudge I needed there!
Of course, all of this talk ignores the numerical inaccuracy of floating
point arithematics. So, I suppose Jim's question hasn't really been
answered yet. How do you write code on a digital machine that does this
correctly.

Well no matter what you do you'll have some amount of inaccuracy. Even if
using fixed point you have that problem if you need to represent a value
that is outside the range what fixed point can represent.

By the way, interesting name. Sounds Japanese. I've been studying it for
little over a year now.

--
Stephan
2003 Yamaha R6

å›ã®ã“ã¨æ€ã„出ã™æ—¥ãªã‚“ã¦ãªã„ã®ã¯
å›ã®ã“ã¨å¿˜ã‚ŒãŸã¨ããŒãªã„ã‹ã‚‰
 
S

Stephan Rose

Ok. So you want the affine case.

I figured that was the case, but I have to admit that my math vocabulary
is a bit rusty. Been a while since I studied all that stuff.
Actually, it is in the affine case with a non-algebraically-closed field
that is the fancy case.

Haha, why am I not surprised!
In the projective case over an algebraically-closed field such as the
complex numbers, the answer is always zero. This is the result by
Bezout's theorem.

I'll have to read up on that. Sound's interesting and maybe I can make
some use of it. Thanks for the info.
But even in the affine case, it is still tractable, at least
qualitatively. You just have to prepare to do some algebraic geometry
and lots of commutative algebra. I believe there're some algebra
computer systems that can handle some commutative algebra computation.

I should probably take some math courses again to refresh my memory. I
did a lot of math when I was back in high school, virtually every class
they let me take, but unfortunately I so rarely needed to use most of it
afterward that most has become quite rusty. I need to shake that rust off
a bit. =)

--
Stephan
2003 Yamaha R6

å›ã®ã“ã¨æ€ã„出ã™æ—¥ãªã‚“ã¦ãªã„ã®ã¯
å›ã®ã“ã¨å¿˜ã‚ŒãŸã¨ããŒãªã„ã‹ã‚‰
 
X

Xohaib

i will read these posts at home and try my best to perform this.. As
my exams are held so i have a little time........ If i am failed to
make these or if i hhad made any mistake would to like to help
me........ ?


Thanx every1 once again....


Regards,
Xohaib
 
S

Stephan Rose

This will work only if by overlapping he meant overlapping of the
boundary only. However, if the interior of the square and circle is
taking into account, you can imagine a very small circle inside a large
square would not be detected.

Of course, it's easy to detected this case. Just check the coordinate
of the center of the circle against the coordinates of the corners of
the square.



For the ellipse, just scale one dimension of the space so that the
ellipse becomes a circle.

I just realized though playing with this today that there actually still
is one problem and that is that when I check one ellipse against another
ellipse. Even if I scale one dimension here am still left with one
ellipse.

--
Stephan
2003 Yamaha R6

å›ã®ã“ã¨æ€ã„出ã™æ—¥ãªã‚“ã¦ãªã„ã®ã¯
å›ã®ã“ã¨å¿˜ã‚ŒãŸã¨ããŒãªã„ã‹ã‚‰
 
K

Kira Yamato

I just realized though playing with this today that there actually still
is one problem and that is that when I check one ellipse against another
ellipse. Even if I scale one dimension here am still left with one
ellipse.

In your original problem, you were checking an ellipse against a cube.
Under the correct transformation of basis, the ellipse will become a
sphere and the cube will become a parallelogram. If I read your
algorithm correctly, you only needed the other shape's boundary to be
decomposable into finite number of planes. So, this should work OK.

If you want to work with two ellipses, then you will need different
techniques. There are lots of intersection theory for algebraic
curves, but I would think we should take this topic on a different
thread and even on a different newgroup instead.

So feel free to start a thread on sci.math if you're interested to
persue this topic further.
 
R

rob

heres one.

make a program that will brute force every letter comination of the
fist five letters in the english alpabet.

ex.
aaaaa
aaaab
aaaac
aaaad

ect...

utill you get to

zzzzz

i will give you a hint you have to ascii
 
V

Victor Bazarov

rob said:
heres one.

make a program that will brute force every letter comination of the
fist five letters in the english alpabet.

ex.
aaaaa
aaaab
aaaac
aaaad

ect...

utill you get to

zzzzz

i will give you a hint you have to ascii

There is no way to complete your assignment. 'z' is not among the
fist five letters in the english alpabet.

And, no, you don't have to ascii. 'a' + 1 == 'b' regardless of the
representation of the 'alpabet'.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top