Can u plx help me to display the score with each correct answer in Jumble word game in C++ and Gwin
here is so far upto where i have gone

#include"gwin.h"
#include <iostream>
#include <string>
#include <fstream>
#include <time.h>

using namespace std;
using namespace GwinColourNames;

int main()
{
    GWindow Gwin(500,400);
    Gwin.clear();

    Gwin.setPenColour(BLACK);
    Gwin.writeText(10,0,"Welcome to Jumble Words");
    Gwin.writeText(10,10,"Unscramble the jumbled letters");
    Gwin.writeText(10,20,"and make a real meaningful word!!");

srand(time(NULL));
unsigned b;
//int b;
int a;
int c=0;
int choice,answe,score,score1=0;
bool isclose=false;
int count=0;

    string guess,name;
    string words[5];
    string Word[5];
    char letters;
   ifstream filein("words.txt");
    if(filein.is_open())
    {
        for(int a=0; a<5; a++)
            filein>>words[a];
    }
    filein.close();
    ifstream filein2("Word.txt");
    if(filein2.is_open())


    {
        for(int a=0; a<5; a++)
            filein2>>Word[a];
    }
    filein2.close();

    ifstream filein3("Score.txt");




    do
    {

        Gwin.clear();
        Gwin.setPenColour(RED);
        b=rand()%5;
        Gwin.writeString(50,50, words[c]);

        Gwin.setPenColour(BLACK);
        Gwin.writeText(0,80,"Enter Your guess:");
        Gwin.refresh();
        guess= Gwin.readString(0,100,10);

    if(guess==Word[c])
        {
            Gwin.writeText(0,150,"Correct!");
            score1 =score1 + 10;

        }
    else
    {
        Gwin.writeText(0,150,"Wrong!");
    }
        c++;
        Keyboard.waitKey();
    }while(c<5);

    /*while ((guess != words[b]) && ( guess != "quit"))
    {

        if(guess==Word[b])
        {
            Gwin.writeText(0,150,"Correct!");
            correctans++;
            ofstream oScore("Score.txt");
            oScore << name <<" " <<score1;
            oScore.close();
            score=score+10;
        }

        else
        {
            Gwin.writeText(0,150,"Wrong");
        }
    };*/
    /*while
        ifstream filein("Score.txt");
    if(filein.is_open())
    {
        for(int a=0; a<5; a++)
            filein>>words[a];
    }
    */




cout<<"press any key to end.."<<endl;
Gwin.refresh();
Keyboard.waitKey();
return 0;
}
This article has been dead for over six months. Start a new discussion instead.