Rock-Paper-Scissors game This is the first piece of code I wrote on my own.  I tried to use everything I know, like functions, loops and variables.  Is it good or could it be simpler?

Please be hard as you can be with me because I feel my programming knowledge is quite poor and I end up using Google for solving my problems.

    // RPS.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include &lt;iostream&gt;
#include &lt;ctime&gt;
#include &lt;cstdlib&gt;

using namespace std;

int nPlayerScore=0;
int nComputerScore=0;
int nPlayerMove=0;
int nComputerMove=0;

void DisplayScore()
{
    cout &lt;&lt; "Player: " &lt;&lt; nPlayerScore &lt;&lt; endl;
    cout &lt;&lt; "Computer: " &lt;&lt; nComputerScore &lt;&lt; endl &lt;&lt; endl;
}

int GetMove()
{
    cout &lt;&lt; "Please choose a move: \n1.Rock\n2.Paper\n3.Scissors\n";
    int x;
    cin &gt;&gt; x;
    cout &lt;&lt; endl;
    return x;
}

void CalculateResults()
{
    if (nPlayerMove==1) //player is Rock
    {
        if (nComputerMove==1) {cout &lt;&lt; "player Rock vs computer Rock: IT'S A TIE!";}
        if (nComputerMove==2) {cout &lt;&lt; "player Rock vs computer Paper: COMPUTER WON!"; nComputerScore=nComputerScore+1;}
        if (nComputerMove==3) {cout &lt;&lt; "player Rock vs computer Scissors: PLAYER WON!"; nPlayerScore=nPlayerScore+1;}
    }
    if (nPlayerMove==2) //player is Paper
    {
        if (nComputerMove==1) {cout &lt;&lt; "player Paper vs computer Rock: PLAYER WON!"; nPlayerScore=nPlayerScore+1;}
        if (nComputerMove==2) {cout &lt;&lt; "player Paper vs computer Paper: IT'S A TIE!";}
        if (nComputerMove==3) {cout &lt;&lt; "player Paper vs computer Scissors: COMPUTER WON!"; nComputerScore=nComputerScore+1;}
    }
    if (nPlayerMove==3) //player is Scissors
    {
        if (nComputerMove==1) {cout &lt;&lt; "player Scissors vs computer Rock: COMPUTER WON!"; nComputerScore=nComputerScore+1;}
        if (nComputerMove==2) {cout &lt;&lt; "player Scissors vs computer Paper: PLAYER WON!"; nPlayerScore=nPlayerScore+1;}
        if (nComputerMove==3) {cout &lt;&lt; "player Scissors vs computer Scissors: IT'S A TIE!";}
    }

cout &lt;&lt; endl &lt;&lt; endl;
}

int main()
{
    do
    {
    cout &lt;&lt; "Welcome to RPS 1.0a \tby GeTAFIX \n\n";
    DisplayScore();
    nPlayerMove=GetMove();
    srand((unsigned)time(0));
    nComputerMove=rand()%(3)+1;
    CalculateResults();
    //cout &lt;&lt; "Press any key to continue...";
    system("pause");
    system("cls");
    } while (1==1);
}
First of all, stop using system("pause"); and system("cls");.  Both of those are not portable, and are silly ways of achieving what you want.  Take a look here for an actual solution.

Secondly, you are seeding the random number generator every iteration.  This is not only unnecessary, it is harmful: if you do this in a program that calls rand more than once a second, you will get the same result each call.  Even if you are only accessing it once a second (as you may be here), it is bad practice in any case, and can lead to a decrease in randomness.

Thirdly, I think you're getting a little far with splitting things into functions.  It might make sense to split the move-reading part into a separate function if you're going to perform input validation, but I think it currently just complicates matters.

Your CalculateResults function is overcomplicated.  If 0 is rock, 1 is paper, and 2 is scissors, and x and y are the choices of the players, you can tell who won with (3+x-y)%3.  If the result is 1 then x has won; if it is 2, then y has won; otherwise (if it is 0) there has been a tie.

Further stylistic issues: you should fix your indentation, turn the do ... while loop into a while(true) or for(;;) loop, stop using using namespace std;, and disable precompiled headers (they offer no benefit for a single-file solution).  You should also output '\n' instead of std::endl unless you explicitly want to flush the stream; an expression like std::cout &lt;&lt; std::endl &lt;&lt; std::endl simply doesn't make sense.

By the way, if you're using Google to solve your C++ problems, you're likely picking up a lot of information that's very wrong.  Make sure you have a good book to learn from, such as Accelerated C++.

Your code could be simplified to this, although the behaviour isn't quite the same:

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;cassert&gt;
#include &lt;ctime&gt;
#include &lt;cstdlib&gt;

std::string numberToWeapon(int n) {
    switch (n) {
       case 0: return "rock";
       case 1: return "paper";
       case 2: return "scissors";
    }
    assert(!"Invalid parameter");
}

int main() {
    std::cout &lt;&lt; "Rock-Paper-Scissors v1.0\n";

    int playerScore = 0;
    int ourScore = 0;
    std::srand(static_cast&lt;unsigned int&gt;(time(0)));

    while (true) {
         int playerMove;
         std::cout &lt;&lt; "Please enter 1 for rock, 2 for paper, or 3 for scissors.\n";
         if (!(std::cin &gt;&gt; playerMove))
             return 0;
         --playerMove;
         if (playerMove &lt; 0 || playerMove &gt; 2) {
             std::cout &lt;&lt; "Invalid input.\n";
             continue;
         }

         int ourMove = rand()%3;

         std::cout &lt;&lt; "You played: " &lt;&lt; numberToWeapon(playerMove) &lt;&lt; ". ";
         std::cout &lt;&lt; "We played: " &lt;&lt; numberToWeapon(ourMove) &lt;&lt; ".\n";
         switch ((3 + playerMove - ourMove) % 3) {
             case 0:
                 std::cout &lt;&lt; "The game is a tie.\n";
                 break;
             case 1:
                 std::cout &lt;&lt; "You won!\n";
                 ++playerScore;
                 break;
             case 2:
                 std::cout &lt;&lt; "We won!\n";
                 ++ourScore;
                 break;
         }

         std::cout &lt;&lt; "The score is currently:\n";
         std::cout &lt;&lt; "You - " &lt;&lt; playerScore &lt;&lt; ".\n";
         std::cout &lt;&lt; "We - " &lt;&lt; ourScore &lt;&lt; ".\n";
    }
}


This results in a larger main function, but no global variables.  You can argue on whether that's any better or not: personally, I think it's clear as it is, and I don't see any duplication, but you may want to experiment.

If you are using C++11, you can get even more awesome syntax than the numberToWeapon function, namely:

std::array&lt;4, std::string&gt; weapons = {"rock", "paper", "scissors"};


And then use weapons.at(num) (or weapons[num] if you're sure you're in-bounds).