donfire's Profile User Rating: -----

Reputation: -1 Dishonored
Group:
Members
Active Posts:
21 (0.03 per day)
Joined:
26-December 12
Profile Views:
253
Last Active:
User is offline Mar 21 2013 11:18 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   donfire has not set their status

Posts I've Made

  1. In Topic: array task, I think is possible..can't figure it out

    Posted 6 Jan 2013

    View PostSkydiver, on 06 January 2013 - 02:30 PM, said:

    The example is right in the text field that you type in. You start out with the word "code" in square brackets, followed by your code, and then end with "/code" in square brackets.

    What you have been doing is start out with the word "code" in square brackets, followed by "/code" in square brackets, followed by your code, and then with the word "code" in square brackets, and finally "/code" in square brackets.

    Anyway, the problem with the code is on line 97 where you have an infinite loop. You are looping while Tally[i] == Tally[j]. Your loops have both i and j starting at zero, so effectively you have: while Tally[0] == Tally[0].

    yes i have two for loops ok..one for i and one for j..is just like two loops to read a matrice of arrays...i starts first at zero...then it stops there then j takes the command..if tally i==tally j..counter should be counting...but j is moving on..soo soon tally i will not be equal to tally j and we come out of the while loop and continue loop j till end of vector...then we start again with loop i...
    there is nothing wrong with that skydiver..the compiler would have told me anyway...
    check again pls..you've been picking on me since yesterday but you are not giving no helping hand man...making the damn site block me from posting and stuff...check again
  2. In Topic: array task, I think is possible..can't figure it out

    Posted 6 Jan 2013

    View PostSkydiver, on 06 January 2013 - 02:20 PM, said:

    Please learn how to correctly put your code within code tags correctly. This is the 3rd time you've opened a related topic and each time, you've failed to put your code within code tags correctly.

    but i do have the code in codetags...show me how then if am doing it wrong..if you say is the third time then am making a mistake..why dont you show me how instead of just complaining...are you the administrator? anyway what about the problem am having? any solution???
  3. In Topic: array task, I think is possible..can't figure it out

    Posted 6 Jan 2013

    I guys...ok so i post the code then underneath it i post my question...thanks

    #include <iostream>
    #include <vector>
    #include <algorithm>
    using namespace std;
    
    int ROW=44;
    
    int LN [][5]={
    /*	 0*/	{37,13,	20, 84,	90},
    /* 1*/	{26,83,	90,	72,	79},
    /* 2	*/{41,80,	39,	60,	40},
    /* 3*/	{4,	46,	85,	61,	9 },
    /* 4*/	{44,62,	74,	70,	49},
    /* 5*/	{28,33,	72,	62,	88},
    /* 6*/	{20,5,	6,	25,	71},
    /* 7 */	{3,	9,	15,	84 ,34},
    /*8*/{7,	52,	25,	83,	88},
    /* 9*/{15,35, 67, 78, 6},
    /*10*/	{53,38,	2,	10,	49},
    /*11*/	{43,83,	17,	37,	15},
    /*12*/	{90,36,	59,	3,	64},
    /*13*/	{59,19,	28,	58,	76},
    /*14*/	{51,81,	2,	8,	67},
    /* 15/*/{64,72,	45,	86,	5},
    /* 16*/{77,89,	38,	72,	45},
    /*17*/{34,1,	74,	61,	89},
    /*18*/{31,25,	75,	37,	84},
    /*19*/	{23, 59, 57,	50,	77},
    /*20*/	{79,90,	1,	23,	16},
    /*21*/	{25,34,	22,	84,	7},
    /*22*/	{70,46,	30,	37,	90},
    /*23*/	{72,55,	75,	64,	71},
    /*24*/	{90,8,	84,	36,	30},
    /*25*/	{34,79,	81,	20,	12},
    /*26*/	{82,56,	77,	49,	69},
    /* 27*/	{42,30,	89,	84,	59},
    /*28*/	{10,6,	68,	50,	87},
    /*29*/	{28,7,	55,	62,	58},
    /*30*/	{31,25, 86,	84,	87},
    /*31*/	{36,66,	53,	3,	77},
    /*32*/	{25,13,	72,	70,	47},
    /*33*/{34, 77,80,	53,	33},
    /*34*/	{86, 71, 23, 90, 8},
    /*35*/{81, 45,	69,	38,	72},
    /*36*/	{24,	61,	74,	41,	72},
    /*37*/	{30, 27, 66, 43, 13},
    /*38*/	{69, 20, 15, 64,59},
    /*39*/	{14, 28, 59, 42, 67},
    /*40*/	{2,	31,	88,	28,	55},
    /*41*/{60,	73,	63,	19,	82},
    /*42*/{67, 4,	42,	27,	29},
    /*43*/	{16, 2,	51,	19,	74}
    };
    int r, c, k, Possiblenumbers1, Numberofpossiblenum=0;
    
    int main ()
    {
    vector<int> Tally;
    
    //1ST rolling, roll will be minus 2
    for (r=0; r<ROW-2; r++)for (c=0;c<5;c++) /*locking a particular row, in this case starting from row 0*/
    
    {
    if(LN[r][c]==LN [ROW-1][0]
    ||LN[r][c]==LN [ROW-1][1]
    ||LN[r][c]==LN [ROW-1][2]
    ||LN[r][c]==LN [ROW-1][3]
    ||LN[r][c]==LN [ROW-1][4]) /*if at least a figure of row analysed equal to a figure of jumping board row*/
    {r+=1; Numberofpossiblenum+=5; // rolling one, would be r=+2 if rolling 2, or 3 if rolling 3 and so on...
    cout<<endl<<"Row number:"<<r<<endl;
    for (c=0;c<5;c++)
    {Tally.push_back(LN[r][c]);
    cout<<LN[r][c]<<", ";
    }
    }
    }
    cout<<endl<<endl<<"Number of possible numbers are: "<<Numberofpossiblenum<<endl<<endl;
    cout<<"...and they are:\n";
    for(int i=0;i<Tally.size();i++)
    cout<<Tally[i]<<", ";
    
    int i,n,j,counter;
    
    
    cout<<endl<<endl<<"We will now find out how many times values are repeated in the Possible Numbers:"<<endl<<endl;
    
    
    cout<<"Numbers place in order;"<<endl;
    sort (Tally.begin(), Tally.end());
    for(int i=0;i<Tally.size(); i++)
    cout<<Tally[i]<<", ";
    cout<<endl<<endl;
    
    for (int i=0;i<Tally.size();i++)
    for (int j=0;j<Tally.size();j++)
    {
    do (counter +=1); while (Tally[i]==Tally[j]);
    cout<<Tally[i]<<" repeated "<<counter<<" times!";
    
    }
    
    return 0;
    }
    
    


    Ok so when i compile the code everything is ok...no problem at all..errors zero...but on the screen the program behaves as if from line 94 to 100 doesnt exit..i mean these lines
    for (int i=0;i<Tally.size();i++)
    for (int j=0;j<Tally.size();j++)
    {
    do (counter +=1); while (Tally[i]==Tally[j]);
    cout<<Tally[i]<<" repeated "<<counter<<" times!";
    
    }
    


    doesnt do cout tally [] repeated counter times..doesnt write anything at all...and i find that soo strange..and i also noticed that it doesnt write program terminated return 0 time...press any key to continue... the cursor just keeps blinking as if it expecting me to insert something...till i close the window myself...
    so i decided to use an online compiler..ideone.com was also telling me i exceeded compile time haha...what the hell is that suppose to mean? Well ok thats not the big deal for me...but ideone.com also ignored line 94 to 100 of my program just like my compiler..I want those line to work too or the program is not complete...can anybody shed some light why this behavior? although there are no compile errors???
    thanks in advance!!!
  4. In Topic: array task, I think is possible..can't figure it out

    Posted 5 Jan 2013

    you mean after sorting i count manually? wow...ok this is just a short code..but the main program should be giving like 300 numbers plus...mmm count manually all the time..is not a good idea :) thanks anyway...
  5. In Topic: array task, I think is possible..can't figure it out

    Posted 5 Jan 2013

    View Post#define, on 05 January 2013 - 12:10 PM, said:

    You could sort your vector beforehand.

    sort

    Another option could be a map.

    sorry but what do you mean by sorting out my vector before hand?...

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

donfire hasn't added any friends yet.

Comments

donfire has no profile comments yet. Why not say hello?