Results 1 to 7 of 7

Thread: A different C++ question     submit to reddit submit to twitter

  1. #1
    Nidhogg
    Join Date
    Jul 2006
    Posts
    3,999
    BG Level
    7

    A different C++ question

    Ok i have no idea wtf im doing wrong because it all looks right to me. . .
    Could someone lease help me out?
    //Homework 2.cpp : Defines the entry point for the console application.

    #include "stdafx.h"


    int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }

    #include <iostream>
    #include <cmath>
    using namespace std;

    int main()
    {

    double R1, R2, R3, R4;

    cout << "Please enter the value for R1: ";
    cin >> R1;
    cout << "Please enter the value for R2: ";
    cin >> R2;
    cout << "Please enter the value for R3: ";
    cin >> R3;
    cout << "Please enter the value for R4: ";
    cin >> R4;

    double RW = R3+R4;
    double Rtotal = 1/(1/R1+1/R2+1/RW);

    cout << "The total resistance of the electrical circuit is:" >> Rtotal;
    }
    edit nvm found it i did ">>" at end insteada "<<" holy shit im a retard < <

  2. #2
    Black Belt
    Join Date
    Nov 2005
    Posts
    5,819
    BG Level
    8
    FFXI Server
    Siren
    WoW Realm
    Thrall

    Re: A different C++ question

    Quote Originally Posted by LinktheDeme
    Ok i have no idea wtf im doing wrong because it all looks right to me. . .
    Could someoen please help me out?
    //Homework 2.cpp : Defines the entry point for the console application.

    #include "stdafx.h"


    int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }

    #include <iostream>
    #include <cmath>
    using namespace std;

    int main()
    {

    double R1, R2, R3, R4;

    cout << "Please enter the value for R1: ";
    cin >> R1;
    cout << "Please enter the value for R2: ";
    cin >> R2;
    cout << "Please enter the value for R3: ";
    cin >> R3;
    cout << "Please enter the value for R4: ";
    cin >> R4;

    double RW = R3+R4;
    double Rtotal = 1/((1/R1)+(1/R2)+1/RW);

    cout << "The total resistance of the electrical circuit is:" >> Rtotal;
    }
    ?

  3. #3
    Chram
    Join Date
    Jun 2006
    Posts
    2,539
    BG Level
    7

    Gotta love microsoftisms like _tmain.. lol

  4. #4
    Relic Weapons
    Join Date
    Jan 2006
    Posts
    373
    BG Level
    4

    Re: A different C++ question

    Quote Originally Posted by LinktheDeme
    Ok i have no idea wtf im doing wrong because it all looks right to me. . .
    Could someone lease help me out?
    //Homework 2.cpp : Defines the entry point for the console application.

    #include "stdafx.h"


    int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }

    #include <iostream>
    #include <cmath>
    using namespace std;

    int main()
    {

    double R1, R2, R3, R4;

    cout << "Please enter the value for R1: ";
    cin >> R1;
    cout << "Please enter the value for R2: ";
    cin >> R2;
    cout << "Please enter the value for R3: ";
    cin >> R3;
    cout << "Please enter the value for R4: ";
    cin >> R4;

    double RW = R3+R4;
    double Rtotal = 1/(1/R1+1/R2+1/RW);

    cout << "The total resistance of the electrical circuit is:" >> Rtotal;
    }
    edit nvm found it i did ">>" at end insteada "<<" holy shit im a retard < <
    The worst part? I found his mistake and was about to say that before he called attention to it.

  5. #5
    Relic Horn
    Join Date
    Mar 2006
    Posts
    3,215
    BG Level
    7

    Yeah, I learned C on linux and i was like "what's that _tmain there... oh well it doesn't look important, probably some C++ thing"

  6. #6
    New Spam Forum
    Join Date
    Oct 2005
    Posts
    197
    BG Level
    3

    its been awhile since i last programmed so can someone explain to me why

    Code:
    #include "stdafx.h"
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }
    is in the code?
    i dont see it being used anywhere.

  7. #7
    E. Body
    Join Date
    Jun 2006
    Posts
    2,181
    BG Level
    7
    FFXIV Character
    Bro Teampill
    FFXIV Server
    Gilgamesh
    FFXI Server
    Ifrit

    Quote Originally Posted by Justice
    its been awhile since i last programmed so can someone explain to me why

    Code:
    #include "stdafx.h"
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }
    is in the code?
    i dont see it being used anywhere.
    _tmain is the Unicode version of main. Why is it in his code? Not a freakin' clue.

Similar Threads

  1. A question to Yummy and Clistophy!!
    By Hirronimus in forum General Discussion
    Replies: 2
    Last Post: 2004-08-11, 00:14
  2. Just got a question for you guys
    By Blackwar in forum General Discussion
    Replies: 3
    Last Post: 2004-08-06, 20:14