General Question

nicky's avatar

Can someone explain how these input statements are handled in c++?

Asked by nicky (207points) September 19th, 2013

I will start off by honestly stating that this has to do with homework, but the question I need to ask by no means gives me a direct answer to the problem i am having trouble with (I can post the problem if you don’t trust me.) I am having trouble understanding what these input statements specifically do as I have vary rarely used c++ input of this type. What is happening for each of these statements:

cin >> sclr >> vec[2*i-1] >> mat[f(i)][j+k] >> t[i/3][j][k];

I need to understand what the last three statements mean in terms of c++ just so that I can actually start the problem i am on. If I had time I would just ask the teacher for clarification but alas I do not. I would greatly appreciate it if some of you c++ gurus could take a minute to explain this to me.

Observing members: 0 Composing members: 0

4 Answers

ARE_you_kidding_me's avatar

You are looking at arrays, the first is one dimensional, send two and the third..three
The formulas inside the brackets calculate the specific array location you are accessing.

rexacoracofalipitorius's avatar

Is that inside an iterator, or are those imaginary numbers?
If you set an array pointer to an imaginary index, do you get an imaginary value?

@ARE_you_kidding_me has it right. That is some gnarly, ugly code though.

ARE_you_kidding_me's avatar

It’s not imaginary, it’s just a variable.

nicky's avatar

Thanks guys for replying. The assignment was to write BNF notation for input statements. It was pretty confusing lol

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther