A Very noobie question!

This is a discussion on A Very noobie question! within the C++ Programming forums, part of the General Programming Boards category; Hey I am currently working on a c++ program that can work out the temperatures and pressures along a Jet ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Location
    UK
    Posts
    4

    A Very noobie question!

    Hey

    I am currently working on a c++ program that can work out the temperatures and pressures along a Jet Engine, however there is one simple problem that is getting in my way.

    How do I do indicies in C++?

    Some of the calcualtions involve T3T4= (P3/P2) ^ (Y/Y-1)

    But I dont know how to get an indice to work in C++, I get an error message complaining about the presence of the floating poing numbers, does anyone know how to implement an indice?

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    250
    pow [C++ Reference]

    ^ in C++ performs a bitwise XOR

  3. #3
    Registered User
    Join Date
    Dec 2009
    Location
    UK
    Posts
    4
    Quote Originally Posted by MWAAAHAAA View Post
    pow [C++ Reference]

    ^ in C++ performs a bitwise XOR
    Thankyou :-) I am too used to matlab for these things...

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    250
    Quote Originally Posted by ewandougie View Post
    Thankyou :-) I am too used to matlab for these things...
    Actually, I was wondering if there was a reason you were not using Matlab.

  5. #5
    Registered User
    Join Date
    Jan 2010
    Posts
    5
    Quote Originally Posted by ewandougie View Post
    Hey

    I am currently working on a c++ program that can work out the temperatures and pressures along a Jet Engine, however there is one simple problem that is getting in my way.

    How do I do indicies in C++?

    Some of the calcualtions involve T3T4= (P3/P2) ^ (Y/Y-1)

    But I dont know how to get an indice to work in C++, I get an error message complaining about the presence of the floating poing numbers, does anyone know how to implement an indice?
    If you mean with ^ to the power as T3T4= (P3/P2) to the power of (Y/Y-1)

    then you should include <cmath>

    and then the statment will be as T3T4= pow((P3/P2),(Y/(Y-1)));

    My Regard,
    Salmi

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,543
    More precisely std::pow((P3/P2),(Y/(Y-1)));
    Or alternatively a using namespace std; at the top of your source file.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  2. A fourth noobie question - namespace std?
    By Noobie in forum C++ Programming
    Replies: 24
    Last Post: 08-12-2005, 02:10 PM
  3. another noobie question
    By noobie in forum C++ Programming
    Replies: 21
    Last Post: 01-21-2003, 01:04 PM
  4. A third noobie question
    By Noobie in forum C++ Programming
    Replies: 5
    Last Post: 01-20-2003, 11:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21