Feel free to ask me (Seriel) things

I can't guarentee a coherent response, but you're welcome to ask questions.
Td4UePt.png
  • Like
Reactions: 10 people

Comments

Train A, traveling 70 miles per hour (mph), leaves Westford heading toward Eastford, 260 miles away. At the same time Train B, traveling 60 mph, leaves Eastford heading toward Westford. When do the two trains meet? How far from each city do they meet?
 
  • Like
Reactions: 2 people
here's solution...
Code:
#include <cstdio>
#define EASTFORD 260
int main() {
    int trainA=0,trainB=EASTFORD,hours=0;
    while(trainA!=trainB){
        trainA+=70;
        trainB-=60;
        hours++;
    }
    printf("They meet after %d hours.\n",hours);
    printf("Train A will be %dmi away from Westford, and %dmi on the way to Eastford,\n",trainA,EASTFORD-trainA);
    printf("Train B will be %dmi away from Eastford, and %dmi to Westford.\n",EASTFORD-trainB,trainB);

    return 0;
}
 
  • Like
Reactions: 3 people
Haha, right, so I'll ask seriel if she can fix solution (modify) using only integer variables. In case when train B traveling with 65mph and if you can't change "while" condition.
 
  • Like
Reactions: 3 people
*beep* - time over
Code:
 #include <cstdio>
#define EASTFORD 260
int main() {
    int trainA=0,trainB=EASTFORD,seconds=0;
    int vA = 70;
    int vB = 65;

    while(trainA!=trainB){
        seconds = trainB * 3600 / (vA + vB);
        trainA = trainB = vA * seconds / 3600;
    }
    printf("They meet after %d hours %d minutes and %d seconds.\n",seconds/3600,seconds/60%60,seconds%60);
    printf("Train A will be %dmi away from Westford, and %dmi on the way to Eastford,\n",trainA,EASTFORD-trainA);
    printf("Train B will be %dmi away from Eastford, and %dmi to Westford.\n",EASTFORD-trainA,trainA);

    return 0;
}
 
  • Like
Reactions: 3 people
Oh man I don't have the patience to quote all of these properly so I'll do it the lazy way.

>Are Frosties really grrrrrrrrreat?
Yes, love them.

> What's your opinion on...say...Xenoblade Chronicles 2?
Never touched it so can't form an opinion, sorry.

> The Land Before Time or Pororo?
I have no idea what either of those are, am I supposed to?

> Why does the light go out if i dont pay for electricity?
The evil bad man comes and takes it away :cry:

> What have you, Seriel, done?
Not much, 2020 has been a lot of sitting around and not much productivity.

> stalk.
Stalk.
 
  • Like
Reactions: 6 people

Blog entry information

Author
Seriel
Views
2,372
Comments
552
Last update

More entries in Personal Blogs

More entries from Seriel

  • Emotional exhaustion
    I feel exhausted, just not physically. My life is riddled with a lot...
  • Inadequacy
    As much as I love to be active and positive and engage with life...
General chit-chat
Help Users
  • No one is chatting at the moment.
    WPiso @ WPiso: m