Clinton Portis 211 Practically a Posting Shark

Firstly, you seem to have a cool chick name; therefore, I will have to ask ye' a/s/l.

Secondly, (without having to look at your code) tie detection in tic-tac-toe can be as simple as testing a turn counter... when a player has reached 5 turns, and none of ye' win functions have returned true, then the only possible scenario a tie.

Clinton Portis 211 Practically a Posting Shark

try changing line #36 to another input >> trash; get rid of the ignore(). delete line #37.
Lines #41 thru #81 seem unnecessary.

Clinton Portis 211 Practically a Posting Shark

but my problem now is that when i try to pass the arrays to the calculate data function its not passing the array and for some reason in they yards array its passing 2750 which is the last number in the yards array.

if it's not too much trouble, would you mind showing us your calculate data function...

Clinton Portis 211 Practically a Posting Shark

Pamela Anderson is one example of a pseudo stack. Others include Heidi Montag, Salma Hayek, Nichole Ritchie, Christina Aguilera and Dollie Parton.

Clinton Portis 211 Practically a Posting Shark

one thing is ye' need to call srand() somewhere in order to seed ye' random number generator.

I would load your entire text file into a data structure, line by line, and then get lines out of the data structure at random.

vector<string> text_file;
int line_counter = 1;
string line;
srand(time(NULL));

//Load the text file
while(getline(infile, line))
{
     text_file.push_back(line);
     line_counter++;
}

//Get a random line
cout << text_file[rand()%line_counter];
Clinton Portis 211 Practically a Posting Shark

you need to make sure your header and function definitions are added to your project.. in dev c++ they will appear in the project window on the left side.

Clinton Portis 211 Practically a Posting Shark

Whether it be making ascii to int conversions, or splitting up a string into tokens, probably the best method to use is <stringstream>. Here is a small example:

// using stringstream constructors.
#include <iostream>
#include <sstream>
using namespace std;

int main () {

  int val = 0;
  stringstream ss;

  ss << "120 42 377 6 5 2000";

  for (int n=0; n<6; n++)
  {
    ss >> val;
    cout << val*2 << endl;
  }

  return 0;
}

and it works both ways (int to ascii).

Clinton Portis 211 Practically a Posting Shark

ye' could chain the cin operation together like this:

cout << "Enter clock time: (HH MM SS) ";
cin >> hour >> min >> sec;

of course this method is highly dependant on the user making proper input seperated with white spaces.

Clinton Portis 211 Practically a Posting Shark

A better bubble sort:

void sort_by_id(student* head_ptr)
{
     student* node = head_ptr;
     student* temp = NULL;
 
     while(node->next != NULL)
     {
          if(node->student_id > node->next->student_id)
          {
               temp = node->next;
               node->next = temp->next;
               temp->next = node;
          } 

          node = node->next;
     }
}
Clinton Portis 211 Practically a Posting Shark

I think what you want to do is to load a text file into a single linked-list data structure, and then offer the user to sort the list by certain attributes; in the case you speak of, by user i.d.

So let's break this mother down step by step.

Let's say your .txt file is similar to this format:

Amanda Hugandkiss 04323 19 3.2
Mike Hunt 346543 17 2.6
Oliver Closeoff 19432 18 2.9
Craven Moorehead 65437 14 3.9

So you would natrually want to design a data structure suitable to the text file:

struct student
{
     string first_name;
     string last_name;
     int student_id;
     int age;
     double gpa;
     student* next;
};

Now ye' task is to load your text file into a data structure; in this case, a linked list:

student* temp = new student,
student* head_ptr = temp;

while(infile)
{
     infile >> temp->first_name;
     infile >> temp->last_name;
     infile >> temp->student_id;
     infile >> temp->age; 
     infile >> temp->gpa;
     temp->next = new student;
     temp = temp->next;
}

temp->next = NULL;

All is fine and dandy. Basic file i/o loaded into a simple link-list data structure. simple pointer assignments make sure you have a dedicated head pointer, and the last pointer points to NULL. life == good.

Now you want to let the user sort the list as they desire. In your case, you would like to sort the list in ascending order based on the student_id attribute. Let's use a basic bubble sort:

void sort_by_id(student* head_ptr)
{ …
Clinton Portis 211 Practically a Posting Shark

1. There are functions to Add, Subtract, Divide, Multiply the fractions.
2. There are two other functions to return the numerator and denominator.
3. Finally, an overloaded operator should be able to compare whether two fraction objects are greater than, less than, or equal to one another.

Although I think overloading the +, -, /, and * operators would make more sense, your instructor specifically asks for functions to peform the respective tasks:

class fraction
{
     ...
     ...
     ...
     int get_numerator(){return num};
     int get_denominator(){return denom};
     fraction add(fraction);
     fraction subtract(fraction);
     fraction divide(fraction);
     fraction multiply(fraction);
     ...
     ...
     ...
};

Here is one free of charge:

//Assumptions:
//Assuming a proper, non-mixed fractions only (Ex.  1/2 + 2/3 = 7/6)
//Assuming proper input, non-zero division from the user.

fraction add(fraction x);
{    
     enum{top, bottom};

     int frac_1[2] = {num, denom};
         frac_2[2] = {x.num, x.denom};
         temp[2]= {0,0};
         factor = 0,
         divisor = 0;
 
     fraction myfraction;

     //Get a factor that will make everything the same
     factor = frac_1[bottom] * frac_2[bottom];

     //Make everything the same
     for(int i=0; i<2; i++)
     {
          frac_1[i] *= factor;
          frac_2[i] *= factor;
     }

     //Add the fractions & store ye' result
     for(int i=0; i<2; i++)
     {
          temp[i] = frac_1[i] + frac_2[i];
     }

     //Begin reduction to lowest term
     //Identify a common divisor (if any)
     for(int i=2; i<temp[bottom]/2; i++)
     {
         //if the divisor 'i' can go into both equally...
         if(!temp[top]%i && !temp[bottom]%i)
         { 
               //then divide the numerator and denomiantor by the divisor.
               temp[top] /= i;
               temp[bottom] /= i; 
               //set 'i' back to 2 …
Clinton Portis 211 Practically a Posting Shark

Line #31: the string class does not offer an overloaded ==, it only offers overloaded = assignment, += accumulation (append), and [] array subscript and of course an overloaded () operator as a constructor. But what the string class does have that ye' can use instead of a == is the compare() function:

//instead of
if(userx == Username) 

//try
if(userx.compare(Username) == 0)

you're probably thinking, "why don't they just add an overloaded string class == comparison operator, they have everthing else..." to which my response would be, "I have no clue." They took the time to make a dedicated function for comparison when it would be just as easy to overload the comparison operator.

they should also make the != operator also.

Clinton Portis 211 Practically a Posting Shark

nice.

Clinton Portis 211 Practically a Posting Shark

A brief translation from C to C++...

#include <iostream>
#include <cstdlib>
#include <time>

void bubble_sort(int n,  int  z[])
{
     int i=0,
         j=0,
         x=0,
         k=0;
     
     for (i=2; i<=n; i++) 
     {
         for (j=n; j>=i; j--)
         {
             if (z[j-1] > z[j]) 
             {
                x = z[j-1]; 
                z[j-1] = z[j];
                z[j] = x;
             }
          }
          
           cout << "Pass: " << i-1;

           for (k=1; k<=10; k++)
           {
               cout << z[k];
           }

           cout << endl;
     }
}          

int main()
{
    int i=0,
        k=0,
        number[11];
    
    srand(time(NULL));
    
    for (i=1; i<=8;i++)
    {
        number[i] = rand()%100;
    }

    cout << "------  before bubble_sort ------------------------------\n";

    for (k=1; k<=8; k++)
    {
        cout << number[k];
    }

    cout << endl << endl;

    bubble_sort(8, number);

    cout << "------ after bubble_sort ------------------------------\n";

    for (k=1; k<=8; k++) 
    { 
        cout << number [k]; 
    }

    cout << endl;    
        
}

2. How would I program this when I want to type numbers myself instead of random numbers.

If I do this, I would have done all of your homework for you. Give it a try yourself. Show us what you come up with.

Clinton Portis 211 Practically a Posting Shark

this isn't that difficult.. it's pretty straight-forward file i/o. which concept is giving you trouble?

Clinton Portis 211 Practically a Posting Shark

I believe that 'i' is used in accordance with the rules of Hungarian Notion; a coding style used to self identify the type variables (int type vars use 'i').

Check out Hungarian Notation.

Clinton Portis 211 Practically a Posting Shark

I think ye' blackjack program should follow this kinda scheme:

//Make your cards like this
struct card
{
     char suit;
     int value;
} deck[52];

//Use these functions to check the hand
bool is_royal_flush(card hand[]);
bool is_straight_flush(card hand[]);
bool is_4kind(card hand[]);
bool is_full_house(card hand[]);
bool is_flush(card hand[]);
bool is_straight(card hand[]);
bool is_3kind(card hand[]);
bool is_2pair(card hand[]);
bool is_pair(card hand[]);
card get_high_card(card hand[]);

A hand can test true for multiple winning hands, so test from highest winning hand to lowest, and break on the first return of 'true'.

Clinton Portis 211 Practically a Posting Shark

try this.

#include<cstring>

char*  y = '\0';
char temp1[100];
char temp2[100];

for (int i=0; i<length-1; i++)
{
     Search(RecordArray,temp1,n,i);
     Search(RecordArray,temp2,n,i+1);  
     
     if(strcmp(temp1, temp2)> 0)
     {
          y = &RecordArray[i][254];
          RecordArray[i][254] = RecordArray[i+1];
          RecordArray[i+1][254] = *y;
     }
}

strcmp() will only give ye' the results you want if both arguments are of equal case (i.e. all upper or all lower case).

also, I am assuming you made RecordArray[ ][256], which means you lose one element for being zero based, and another element for null termination.

Clinton Portis 211 Practically a Posting Shark

anytime you have to insert something somewhere in a vector, other than at the very end, then ye' should not use a vector. consider using queue or deque.

Clinton Portis 211 Practically a Posting Shark
Clinton Portis 211 Practically a Posting Shark

I don't know how to do file i/o in C. I only know c++.

WaltP commented: Then why bother to post? -4
cse.avinash commented: yep. dont post then -1
Clinton Portis 211 Practically a Posting Shark

try this:

for (int i=2; i <= sqrt(n); i++)
Clinton Portis 211 Practically a Posting Shark

On your intended last iteration, line #12 will test true; however, line #14 will perform one additional calculation that you probably don't want it to do and will subsequently print the result (line #15.)

One solution could be to change your loop to a do/while so the evaluation to continue the loop would occur after the line #14 computation.

Clinton Portis 211 Practically a Posting Shark

int strcmp ( const char * str1, const char * str2 );
Compare two strings

Compares the C string str1 to the C string str2.
This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until a terminating null-character is reached.

Return Value
Returns an integral value indicating the relationship between the strings:
A zero value indicates that both strings are equal.
A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2; And a value less than zero indicates the opposite.

There may be some upper or lower case issues with using strcmp(). strcmp() will compare the ascii value of the non-matching characters and can assume that the character with the lower ascii value will occur first alphabetically (assuming they are of the same case; an upper case 'Z' will have a lower value than a lower case 'a' for example.) Consider using the <cctype> tolower() or toupper() functions to make everything the same.

check out the ascii table.

Clinton Portis 211 Practically a Posting Shark
struct service_plan
{
     int account_number;
     char service_code;
     int data_size;
}


int main()
{
     //create an array of service_plans

     //start loop

          //prompt user for account number
          //prompt user for service code
          //prompt user for amount of data
          //ask user if they would like to enter another record
          //increment an array counter

     //end loop

     //start loop

          //display element account_number
          //display element service_code
          //display element data_size
          //increment array counter
  
     //end loop

     return 0;
}
Clinton Portis 211 Practically a Posting Shark

the only problem I have is getting the highest average grade.

double get_highest_average_grade(int grades[8][3]);
{
     double averages[8];

     //outside loop
          //inside loop       
             //add 3 elements 
             //divide by 3
             //store result in averages[]

     //Begin Loop      
          //compare current element to next element of the averages[] array
          //save the highest of the two in a temp variable

      //return temp
}
Clinton Portis 211 Practically a Posting Shark

you just can't arbitrarily assign a const char cstring to a buffer. it physically has to be copied element by element. the <cstring> library has everything you need to make cstring assignments:

#include <cstring>

char* lock = new char[501];

char ret[501] =  "this is a fine program";

strcpy(lock, ret);

the low-level power of c is cool, but when you take on the responsibility for allocating your own blocks of memory, you need some tools to help with handling character arrays (in this case, the tools are in the <cstring> library).

in contrast, a more object oriented approach would be to use the <string> class, which does offer an overloaded = assignment operator that would allow ye' to assign a string literal to a string class object.

Clinton Portis 211 Practically a Posting Shark

ye problem is right here:

if(x = i)

you seem to be an intelligent individual. take this opportunity to fix ye' error.

Clinton Portis 211 Practically a Posting Shark

try codeblocks or bloodshed dev c++.

Clinton Portis 211 Practically a Posting Shark

ran out of edit time.

If you want a strictly c++ approach, you could create a master .txt file of all the file paths for all your files. This will allow you to load and search through all ye' existing files.

////master.txt
//a list of all your existing text files
aaron_rogers.txt
brett_favre.txt
calvin_johnson.txt
jahvid_best.txt
mathew_stafford.txt
tom_brady.txt
tony_romo.txt

Now you can do a little somthin' like this:

//will return the names o' the files that contain your keyword
string keyword_search(string& target, ifstream& master)
{     
     ifstream customer;
     string file_path;
     string cust_info;
     string not_found("not found");

     getline(master, file_path);
         
     customer.open(file_path.c_str());

     if(!customer.is_open())
     {
          cout << "\aError! " << file_path << " could not be opened. ";
          cout << "\nFile may have been moved, renamed, or deleted. ";
          cout << "\nPress [ENTER] to continue... ";
          cin.get();
          return not_found;
     }
  
     while(getline(customer, cust_info));
     {               
          if(cust_info.find(target.c_str());
          {
               customer.close();
               return file_path;
          }
     }

     customer.close();
     return not_found;
}

call this funtion in a loop and store all the results in a string array.

Clinton Portis 211 Practically a Posting Shark

If you want a strictly c++ approach, you could create a master .txt file of all the file paths for all your files. This will allow you to load and search through all ye' existing files.

////master.txt
//a list of all your existing text files
aaron_rogers.txt
brett_favre.txt
calvin_johnson.txt
jahvid_best.txt
mathew_stafford.txt
tom_brady.txt
tony_romo.txt

Now you can do a little somthin' like this:

//will return the names o' the files that contain your keyword
string keyword_search(string& target, ifstream& master)
{     
     ifstream customer;
     string file_path;

     getline(master, file_path);
    
     customer.open(file_path.c_str());

     if(!customer.is_open())
     {
          cout << "\aError! " << file_path << " could not be opened. ";
          cout << "\nFile may have been moved, renamed, or deleted. ";
          cout << "\nPress [ENTER] to continue... ";
          cin.get();
     }
  
     while(customer)
     {               
          if(file_path.find(target.c_str());
          {
               customer.close();
               return file_path;
          }
     }

     customer.close();
     return;
}

call this funtion in a loop and store all the results in a string array.

Clinton Portis 211 Practically a Posting Shark
#include<windows.h>
#include<iostream>
#include<cctype>
#include<cstdlib>
#include<ctime>

using namespace std;

class Roulette
{
   public:
             
      Roulette();      
      
      void board_display();
      void prompt();
      void bet_menu();
      void place_bet();
      void set_bet(int choice);
      void set_bet(int menu_choice, int number, int amount); 
      void set_chip(int);
      void set_chip(int, int);          
      void spin_the_wheel();     
      void win_or_lose();
      void reset();
      bool quit();
      void gotoxy(int x, int y);      
        
      bool win_straight_up();   //35:1 + bet back
      bool win_column();        // 2:1 + bet back
      bool win_low();           // 1:1 + bet back
      bool win_high();          // 1:1 + bet back
      bool win_even();          // 1:1
      bool win_odd();           // 1:1
      bool win_red();           // 1:1
      bool win_black();         // 1:1
      bool is_black(int); 
      
      void input_error();
      void bet_error();
      void domain_error();
      void cap_error();
      
   private:
              
      bool is_bet,
           is_quit;      
      
      int  total,
           available,
           winnings,
           winner,
           bet_array_side[9],
           bet_array_number[36],
           zero_coords_x[2],
           zero_coords_y[2],           
           side_coords_x[6],
           side_coords_y[6],
           num_coords_x[36],
           num_coords_y[36],
           col_coords_x[3],
           col_coords_y[3];         
              
};

int main()
{
    Roulette myRoulette;
    
    myRoulette.board_display();
    
    do{          
          myRoulette.prompt();             
    
    }while(!myRoulette.quit());
    
return 0;
}


//////////////////////////////////////////////
///////////////////// Function Definitions //
////////////////////////////////////////////

Roulette::Roulette()
{
   is_bet  = FALSE;
   is_quit = FALSE;
   total  = 2500;
   available = 200;
   winnings = 0;
   
   srand((unsigned)time(NULL));  
   
   for(int i=0; i<9; i++)
   
      bet_array_side[i] = 0;
      
   for(int i=0; i<36; i++)
   
      bet_array_number[i] = 0; 
   
   for(int i=0, x=8; i<2; i++, x+=15)
   {
      zero_coords_x[i] = x;
      zero_coords_y[i] = 6;
   }      
   
   for(int i=0, y=13; i<6; i++, y+=8)
   {
      side_coords_x[i] = 35;
      side_coords_y[i] = y;
   }
   
   for(int i=0, x=5, y=10; i<36; i++, x+=10)
   {
       if(x>26)
       {               
            x = 5;
            y+= 4;
       }
       
      num_coords_x[i] = x;
      num_coords_y[i] = y;
   }
   
   for(int i=0, x=8; i<3; i++, x+=10)
   {
      col_coords_x[i] = x;
      col_coords_y[i] = 56; 
   }   
}   
   
void Roulette::board_display()
{
   cout << " _____________________________ "
        << "\n|      ___ …
WaltP commented: You're kidding, right? I thougt you knew better than this! -4
Clinton Portis 211 Practically a Posting Shark

I am having a tough time figuring out how to first approach this without confusing myself.

1. create an ifstream object
2. open your master file.
3. check for errors.
4. load ye' master file into a vector< > of structs.
5. close the ifstream object

6. create another ifstream object.
7. open your transaction file.
8. check for errors.
9. load ye' transaction file into a deque< > of structs.
10. close the ifstream object.

11. perform ye' calculations via comparison of the master file array and the transaction array. edit the transaction array as necessary.

12. create an ofstream object
13. open the transaction file (using the ios::trunc flag to over-write existing text)
14. write the newly edited contents of the transaction deque< > to the transaction file.
15. close the ofstream object.

ye' are done.

I will offer code for any 3 of the above given steps of your choice, free of charge. Choose wisely.

Clinton Portis 211 Practically a Posting Shark

I will gladly be more specific; allow me to take this opportunity to remind ye' that YOU ARE POSTING C CODE IN A C++ FORUM. I don't go to a Java forum and post Pascal. I don't go to a C# forum and post QBasic. I don't go to McDonalds and ask for a Whopper. Why do people insist on posting C code up in here and expect results...???!

WaltP commented: Cool it. It's not the end of the world. -4
Clinton Portis 211 Practically a Posting Shark

I've read your post, and looked over 395 lines of code, but I still don't know what your problem is. What part doesn't work? What topics are ye' having trouble with? What are your homework requirements? What line(s) of code do you have questions about? What errors and warning is your compiler producing? Why are you using gotoxy()?

The only thing I know at this point, is that "you made your own project, and it didn't work."

Before we go any further, it is important that you read this before things get really ugly.

Here is one excerpt from the link I just provided ye:

Ask a question that can be answered. Do not ask
What's wrong with my code?
Why doesn't this work?
Anything else that does not give us useful information
We're not psychic. Please organize your thoughts and provide as much information as possible to get us onto the same page. If we have to play 20 questions just to get enough information to help you, your question is more likely to go unanswered.

Clinton Portis 211 Practically a Posting Shark

begone with your c code...!

Clinton Portis 211 Practically a Posting Shark

I've dabbled in winsock a bit. So i'll throw in me' two cents:

I believe you should have a couple of struct attributes that include the 'type' of struct, and perhaps also the 'size' of the struct. These should probably be the first two things ye' test for as a client. Then ye' can identify and handle the type of data ye' are receiving.

there seems to be a common theme among win32 and winsock ADT's in that they usually contain a 'header' of some sort, which tells you everything you need to know about the struct, before you even begin to dig into of the contents of the struct. Try employing a similar strategy in the design your ADT's.

extra bonus
(also, i believe the size of many Winsock structs are 'padded' with useless attributes to the nearest power of 2 (128, 256, 512, 1024, etc) for sending and receiving efficiency. Win32 ADT's employ the same strategy for memory management efficiency.)

Clinton Portis 211 Practically a Posting Shark

Hola chica de newbiliciousness

after briefly lookin' at ye' code, try this:

//instead of
}while(choice != 'N');

//try
}while(choice != 'n' || choice != 'N');
//and
}while(choice != 'z' || choice != 'Z');

//cool alternatives
}while(toupper(choice) != 'N');
//or
}while(tolower(choice) != 'z');
Clinton Portis 211 Practically a Posting Shark

whenver ye' mix formatted and unformatted types o' input, ye' are acksin' for trouble. try cin.ignore() after line #5.

flush your buffer.

Clinton Portis 211 Practically a Posting Shark

the program does what you want it to do so it can't be all that bad.

Clinton Portis 211 Practically a Posting Shark

try this:

int row = 0;
float data = 0.00;
vector<vector<float> > initMatrix(5, vector<float>(cols));

while(myfile)
{
     // --Handle 1D element allocation--
     //Resize every 5 loop iterations (why not? it's more efficient than re-sizing every time)
     //This is make sure you have a 1D element allocated in which to 'push_back()' to

     // **Make sure the initMatrix vector is initialized to at least 5 1D elements**
     if(!(row%5))
     {
          initMatrix.resize(row+5);
     }

     //since you have a set number of columns, we can make a known number of reads per line
     //this will assume three pieces of data per line (3 columns)
     for(int i=0; i<3; i++)
     {
          infile >> data;
          initMatrix[row].push_back(data);
     }

     row++;
}
Clinton Portis 211 Practically a Posting Shark
ifstream infile;
string line_of_text;
int pos = 0;
vector<string> txt_files;
vector<string> png_files;
vector<string> doc_files;
vector<string> bmp_files;


infile.open("directorycontents.txt");

if(!infile.is_open())
{
     cout << "\aError opening file!";
     cout << "\nFile may have been deleted, moved, or renamed.";
     exit(EXIT_FAILURE);
}

while(infile)
{
     getline(infile, line_of_text);

     if(line_of_text.find(".txt"))
     {
          txt_files.push_back(line_of_text);
     }

     if(line_of_text.find(".png"))
     {
          png_files.push_back(line_of_text);
     }

     if(line_of_text.find(".doc"))
     {
          doc_files.push_back(line_of_text);
     }

     if(line_of_text.find(".bmp"))
     {
          bmp_files.push_back(line_of_text);
     }
}

infile.close();

for(int i=0, size=txt_files.size(); i<size; i++)
{
     cout << txt_files[i] << endl;
}

for(int i=0, size=png_files.size(); i<size; i++)
{
     cout << png_files[i] << endl;
}

for(int i=0, size=doc_files.size(); i<size; i++)
{
     cout << doc_files[i] << endl;
}

for(int i=0, size=bmp_files.size(); i<size; i++)
{
     cout << bmp_files[i] << endl;
}
Clinton Portis 211 Practically a Posting Shark

Look up any tutorial on the c++ concept of 'dynamic arrays'

int* myArray = new int[n];
Clinton Portis 211 Practically a Posting Shark

settle down ma'am.

Clinton Portis 211 Practically a Posting Shark

i think they already made a guide called 'programming for idiots.'

Clinton Portis 211 Practically a Posting Shark
while(product <= 1000)
{
     product = result * multiplier;
     result = product;
}
Clinton Portis 211 Practically a Posting Shark

Im trying to verify predetermined char in random array so i can know if some of the three char appear three times or more.

i would probably write a function that will return the number of occurances the desired char appears in your array. then you can test for this condition and handle it accordingly:

int get_occurances(char array[], int& size, char& target)
{
     int counter = 0;      

     for(int i=0; i<size; i++)
     {
          if(array[i] == target)
          {
               counter++;
          }
     }

     return counter;
}

or you can just use the cout() function from the <algorithm> library:

#include <algorithm>

int counter = 0;

counter = count(&array[0], &array[size], target);

//handle the case of the desired char occuring more than 3 times
if(target > 3)
{
     //do whatever you wanted to do here
}
Clinton Portis 211 Practically a Posting Shark

I would help you with this, but I don't know how to play the game!

Clinton Portis 211 Practically a Posting Shark

if someone else gave you the pile of crap known as lines #16 & #17 (or #40 & #41 in your second example) then yes, by all means, take the initiative and change it to something that resembles working c++ code.

Clinton Portis 211 Practically a Posting Shark

this doesn't fly.. for several reasons.

char* s2 = "education";

try this:

char s2[20] = {'e','d','u','c','a','t','i','o','n', '\0'};

or this:

char* s2 = new char[20];
strcpy(s2, "education");