sfuo 111 Practically a Master Poster

After looking at your checkWin function you can change it from

if((B[0][0] == B[0][1] && B[0][1] == B[0][2]))
{
	if (B[0][0]=='x')
		win=1;
	else if (B[0][0]=='o')
		win=2;
	if (B[0][1]=='x')
		win=1;
	else if (B[0][1]=='o')
		win=2;
	if (B[0][2]=='x')
		win=1;
	else if (B[0][2]=='o')
		win=2;
}

to this

if( B[0][0] == B[0][1] && B[0][1] == B[0][2] )
{
	if ( B[0][0] == 'x' )
		win = 1;
	else if ( B[0][0] == 'o' )
		win = 2;
}

for each of them because you already know that B[0][x] where x is 0 1 2 are all the same.
Also I would use else if for each row/col/diag check because a win is a win and you do not need to check to see if you won in 2 different ways so there is no point in checking more than one way if you do not have to.

sfuo 111 Practically a Master Poster

OK my above post works but there are a few things that you have to do that I missed out.
-First change line 14 to numberUsed (not sure why I put numberTaken)
-Either create a getPhoneNumber() function that returns the phoneNumber or make it public (up to you)
-Add an error message saying that the phone number is taken and I would also output something showing what PhoneCall you are entering for (could use the i counter +1)

sfuo 111 Practically a Master Poster

This is what I would do for your main() function.

int main()
{
	bool numberUsed;
	PhoneCall calls[10];
	for( int i = 0; i < 10; i++ )
	{
		do
		{
			numberUsed = false;
			cin >> calls[i];
			for( int c = 0; c < 10; c++ ) //go through all phone calls
				if( c != i ) //if is not the same phone call
					if( calls[i].phoneNumber == calls[c].phoneNumber ) //if the numbers match
						numberTaken = true; //number is taken
			
		}while(numberUsed); //do while numberTaken is true
	}
	
	for( int i = 0; i < 10; i++ )
	{
		cout << calls[i];
	}
	
	system("pause");
	return 0;

}

Change the constructor for your PhoneCall class to PhoneCall(int length = 0, double rate = 0, int num = 0); This way when you make the PhoneCalls and do not specifiy a value for each variable it just defaults them to zero.

sfuo 111 Practically a Master Poster

Is this what you are looking for?

#include <iostream>
using namespace std;

int main()
{
	int input;
	cin >> input;
	
	for( int i = 0; i < 10-input; i++ )
		cout << "*";
	cout << "O";
	for( int i = 0; i < input; i++ )
		cout << "*";
	
    system("PAUSE");
    return 0;
}
sfuo 111 Practically a Master Poster

Thats what I thought at first but it doesn't work like that and in the .cpp files you have to include "lib.h" and not just its header file or it will do the same thing saying that stuff doesn't exist.

sfuo 111 Practically a Master Poster

In your "rectangle.h" file change "lib.h" to "point.h"

sfuo 111 Practically a Master Poster

I rewrote what you had out and included a "lib.h" file so you do not have to keep typing out all the includes.

"point.h"

#ifndef POINT_H
#define POINT_H

class POINT
{
	//for whatever reason most people that I see post put
	//"private:" here when classes are automaticly private at the start
	double x, y;
	POINT* next;
	
	public:
	POINT(): x(0.0), y(0.0), next() {};
	
	void addPoint( char **a );
};

#endif

"arrayholder.h"

#ifndef ARRAYHOLDER_H
#define ARRAYHOLDER_H

#include "point.h" //the only thing that has to be included here

class ARRAYHOLDER
{
	char a[40][40];
	POINT* listpointer;
	
	public:
	
	char** initarray();
	void printRect();
	void printPoints();	
};

#endif

"lib.h"

#ifndef LIB_H
#define LIB_H

#include <iostream>

using namespace std;

#include "arrayholder.h"
#include "point.h"


#endif

"main.cpp"

#include "lib.h" //only have to include "lib.h" file

int main()
{
	
	system("PAUSE");
	return 0;
}

If you were to make a "point.cpp" file to hold all the functions in it you just have to include "lib.h" and then for each function type returnType POINT::functionName(parameters) This is just incase you do not know how to do that and if you do then you can just ignore it.

sfuo 111 Practically a Master Poster

Yeah submit what you have because it works I will just post pretty much the same thing but with using functions and I'll clean up some parts.

sfuo 111 Practically a Master Poster

I got it to break the loop and quit the program but if you pick a card that has already got picked it will flip it back to 0.

The two things that I wanna ask you are:
1- Are you allowed to use functions?
2- Can I rewrite this for you and add comments showing you how to have a better structure?

sfuo 111 Practically a Master Poster

I'm not saying that will fix it I'm just saying thats a problem with your code. I don't really like trying to fix up code that is poorly formatted but I'll give this a try since I helped you with part of it already.

sfuo 111 Practically a Master Poster

Heres another thing.
You are making the variable bool nullexists up at the top and then when you are doing anything with it you remake a new bool variable with the same name.

Line numbers are based off first post.

Line 26: bool nullexists = true; This is fine.

Line 78: while(nullexists = true) change to -> while(nullexists == true) Line 121: bool nullexists = false; change to -> nullexists = false; Line 124: if(bool nullexists = false) change to -> if(nullexists == false) Here is another way of writing "if(a == true)" and "if(a == false)". if(a) <- if it is true if(!a) <- if it is false
This works for bool variables.

You even have it from the code I provided with "makeNext".

sfuo 111 Practically a Master Poster

Well I'll look into them a bit more and learn more about them thanks for showing me that they aren't out of date.

sfuo 111 Practically a Master Poster

The main namespace people use is std. I don't know anyone and haven't seen any posts where people make their own namespace.

sfuo 111 Practically a Master Poster

namespaces are out of date IMO so if you are using them I think you are just making stuff more complex.

sfuo 111 Practically a Master Poster

I put together this to show you the void function part and I included how to make the 5 random numbers.

Things you need to do:
-User input for 5 numbers (check each to see if they are within 1-55)
-Make a checker for what numbers the user got right (in the void function)
-Output the numbers that the user got correct (in the void function)

#include <iostream>
#include <time.h>

using namespace std;

void check(int input[5])
{
	bool used;
	int randNum[5];
	memset(randNum, 0, sizeof(randNum));
	srand(time(NULL));
	
	//creates the 5 unique random numbers
	for( int i = 0; i < 5; i++ )
	{
		int number = rand()%54+1;
		do
		{
			used = false;
			for( int c = 0; c < 5; c++ )
			{
				
				if( number == randNum[c] )
					used = true;
				
			}
		}while(used);
		randNum[i] = number;
	}
	
	//checks to see what numbers the user got right
	
	
	
	//outputs numbers the user got right
	
	

}

int main()
{
	int numbers[] = {1, 2, 3, 4, 5};
	check(numbers);
	system("PAUSE");
	return 0;
}
sfuo 111 Practically a Master Poster

Yeah the int 30 converted to hex is 1E. The press any key to contiune is because thats then end of the program. cout << hex << number << endl; This will space them out so you can see what is going on better.

As for converting text to hex you might want to take user input as a string then take the string and go through each element and convert that into hex.

--Why do people not just put using namespace std; no one uses namespaces any more.

sfuo 111 Practically a Master Poster

The three functions that you need to look at are substr(), atoi(), and find(). All of these can be found here.
substr will create a string from say 0 to 1 and will hold "10" and then you use atoi() to convert "10" to 10 (integer) you might have to use .c_str() to convert your string to a cstring (const char*) inorder to use the atoi() function.
You can use the find() function to find the spaces in the string to do your substr() function.

Work out what you can and if you run into problems just post up your code I made a program a while ago for my friend that does exactly what you are looking for but I'm not going to hand it out with no code shown here.

PS the website I linked to is very good I would say. It is where I learned C++ and I use it often for reference. The tutorial section is here.

sfuo 111 Practically a Master Poster

I see you just took the allinone.cpp if you actually want to learn some form of structure for coding bigger projects I suggest you look at the divided files and then look at the single. I find looking at something with 500+ lines a little overwhelming when you are just starting out.

sfuo 111 Practically a Master Poster

I have helped you out by writing what I think you want and put it into a "cleaner" format (could be more clean) and divided it into seperate files for structure. (file allinone.cpp is the whole thing in one file if this is for school and they want it in one)

I did my best to comment lines to show you what is going on.

I attached all the files.

sfuo 111 Practically a Master Poster

I did post a solution in the other thread you started here.
As far as implementation goes I'm sure if you have seen any of my posts I am better off taking your code and putting it all together then commenting some changes rather than telling you where to put stuff.

sfuo 111 Practically a Master Poster

Since I made the above code kidna fast I noticed while making this one that it has a fatal flaw in it where it just keeps looping if the number was taken since I didn't reset "used" back to false in the loop.

Here is the same code fixed up and using arrays.

#include <iostream>
#include <vector>
#include <time.h>

using namespace std;

int main()
{
	bool used;
	int usedNumbers[15], ordinary[10], extra[5], number;
	memset(usedNumbers, 0, sizeof(usedNumbers));//sets all elements of usedNumbers to 0
	
	srand(time(NULL));
	
	//make ordinary
	for( int i = 0; i < 10; i++ )
	{
		do
		{
			used = false;
			number = rand()%50+1;
			
			for( int c = 0; c < 15 ; c++ ) //nothing changed aside from setting limit to 15 instead of size
			{
				if( number == usedNumbers[c] )
				{
					used = true;
				}
			}
		}while(used);
		
		usedNumbers[i] = number;
		ordinary[i] =  number;
	}
	
	//make extra
	for( int i = 0; i < 5; i++ )
	{
		do
		{
			used = false;
			number = rand()%50+1;
			
			for( int c = 0; c < 15; c++ ) //nothing changed aside from setting limit to 15 instead of size
			{
				if( number == usedNumbers[c] )
				{
					used = true;
				}	
			}
		}while(used);
		
		usedNumbers[i+10] = number; //add 10 because dont want to overwrite the numbers we got from the above loop
		extra[i] = number;
	}
	cout << "run 3" << endl;
	
	for( int i = 0; i < 10; i++ )
	{
		cout << ordinary[i] << " ";
	}
	cout << endl;
	
	for( int i = 0; i < 5; i++ )
	{
		cout << extra[i] << " ";
	}
	cout << endl;

     
	system("PAUSE");
	return 0;
}
sfuo 111 Practically a Master Poster

I used vectors for this because I like them and they are easy to use. I think this is what you are looking for it generates the numbers and then stores them into the usedNumbers vector and then each time it makes a number it checks to see if it was used already.

You could make the same thing work using arrays but you would want to set each element of usedNumbers to zero and then instead of doing the for() loop to the usedNumbers.size() you would use 15.

Anyways here is the code I hope it helps and you learn from it.

#include <iostream>
#include <vector>
#include <time.h>

using namespace std;

int main()
{
	vector<int> usedNumbers, ordinary, extra;
	srand(time(NULL));
	
	//make ordinary
	for( int i = 0; i < 10; i++ )
	{
		int number;
		bool used = false;
		do
		{
			number = rand()%50+1;
			
			for( int c = 0; c < usedNumbers.size() && usedNumbers.size() != 0; c++ )
			{
				if( number == usedNumbers[c] )
				{
					used = true;
				}	
			}
		}while(used);
		
		usedNumbers.push_back(number);
		ordinary.push_back(number);
	}
	
	//make extra
	for( int i = 0; i < 5; i++ )
	{
		int number;
		bool used = false;
		do
		{
			number = rand()%50+1;
			
			for( int c = 0; c < usedNumbers.size(); c++ )
			{
				if( number == usedNumbers[c] )
				{
					used = true;
				}	
			}
		}while(used);
		
		usedNumbers.push_back(number);
		extra.push_back(number);
	}
	
	for( int i = 0; i < ordinary.size(); i++ )
	{
		cout << ordinary[i] << " ";
	}
	cout << endl;
	
	for( int …
sfuo 111 Practically a Master Poster

OK first off I would like to say this is not that great of a way to do it but it works. This generates pairs of numbers from 1-8 at random locations in your matrix (I picked 1-8 because you have a 4x4 matrix) and thats pretty much it.

#include <iostream>
#include <time.h>

using namespace std;

int main()
{
	int cards[4][4];
	bool makeNext = false;
	memset(cards, 0, sizeof(cards));
	srand(time(NULL));
	
	for( int i = 1; i < 9; i++ )
	{
		makeNext = false;
		while(!makeNext)
		{
			int x1, y1, x2, y2;
			x1 = rand()%4;
			y1 = rand()%4;
			x2 = rand()%4;
			y2 = rand()%4;
			if( (x1 != x2 || y1 != y2) && (cards[x1][y1] == 0 && cards[x2][y2] == 0) )
			{
				cards[x1][y1] = i;
				cards[x2][y2] = i;
				makeNext = true;;
			}
		}
	}
	
	for( int i = 0; i < 4; i++ )
	{
		for( int c = 0; c < 4; c++ )
		{
			cout << cards[i][c] << " ";
		}
		cout << endl;
	}

	
	
     
	system("PAUSE");
	return 0;
}
sfuo 111 Practically a Master Poster

I fixed up your code and added some comments tell me if I changed it from what you were wanting to do.

#include <vector>
#include <iostream>

using namespace std;

class A
{
	public:
	A(){};
	~A();
	
	std::vector<int> temp; //not sure how big your program is or how advanced you are but I hate using std:: I just use the namespace for small stuff
};

class B
{
	public:
	A *a1; //declare here
	B();
	~B();
	int test();
};

B::B()
{
	a1 = new A; //define here
	a1->temp.push_back(5); //put a value to the vectore for testing length
}

int B::test() //didn't have return type int like function prototype has
{
	return a1->temp.size(); //you wern't returning anything either
}

int main()
{
	B *b = new B;
     
	cout << b->test() << endl;
     
	system("PAUSE");
	return 0;
}
sfuo 111 Practically a Master Poster

In the code I posted I tested what you wanted and it worked.

sfuo 111 Practically a Master Poster

twomers beat me to it but yes that is an easy fix for it.

sfuo 111 Practically a Master Poster

This is what I would do.

#include <iostream>
#include <string>

using namespace std;

int main()
{
	int myInt;
	string myString;
	
	cin >> myInt;
	cin.ignore(); //use this it ignores the last '\n' character
	getline(cin, myString);
	
	system("PAUSE");
	return 0;
}
sfuo 111 Practically a Master Poster

I wrote something for this and if you want to put in more numbers its really easy (not as easy if you would just use arrays) if you read the code and see what I'm doing.

#include <iostream>

using namespace std;

int main()
{
	int n1, n2, n3, n4, n5, a, b;
	
	cout << "input n1: ";
	cin >> n1;
	cout << "input n2: ";
	cin >> n2;
	cout << "input n3: ";
	cin >> n3;
	cout << "input n4: ";
	cin >> n4;
	cout << "input n5: ";
	cin >> n5;
	
	for( int i = 1; i <= 5; i++ )
	{
		switch(i)
		{
			case 1:
				a = n1;
				break;
			case 2:
				a = n2;
				break;
			case 3:
				a = n3;
				break;
			case 4:
				a = n4;
				break;
			case 5:
				a = n5;
				break;
		}
		for( int c = 1; c <= 5; c++ )
		{
			switch(c)
			{
				case 1:
					b = n1;
					break;
				case 2:
					b = n2;
					break;
				case 3:
					b = n3;
					break;
				case 4:
					b = n4;
					break;
				case 5:
					b = n5;
					break;
			}
			if( b > a )
			{
				int temp = a;
				a = b;
				b = temp;
			}
			
			switch(i)
			{
				case 1:
					n1 = a;
					break;
				case 2:
					n2 = a;
					break;
				case 3:
					n3 = a;
					break;
				case 4:
					n4 = a;
					break;
				case 5:
					n5 = a;
					break;
			}
			
			switch(c)
			{
				case 1:
					n1 = b;
					break;
				case 2:
					n2 = b;
					break;
				case 3:
					n3 = b;
					break;
				case 4:
					n4 = b;
					break;
				case 5:
					n5 = b;
					break;
			}

		}
		
	}
	
	cout << n1 << " " << n2 << " " << n3 << " " << n4 << " " << n5 << endl;
	
	system("PAUSE");
	return 0;
}
sfuo 111 Practically a Master Poster

I love it how we post at the same time and our find lowest test score function is pretty much identical.

sfuo 111 Practically a Master Poster

I left out a few things like setting the precision of the floats but other than that I think this code will work fine (I made it fast and didn't debug it very much).

#include <iostream>
#include <iomanip>
#include <fstream>

using namespace std;

double findLowest(double t1, double t2, double t3, double t4)//finds the lowest
{
	double lowest = t1;
	
	if( t2 < lowest )
		lowest = t2;
	if( t3 < lowest )
		lowest = t3;
	if( t4 < lowest )
		lowest = t4;
		
	return lowest;
}

int main()
{
	double test1, test2, test3, test4, lowest, average;
	
	ifstream in;
	ofstream out;
	
	in.open("input.txt");//change to your input file
	out.open("output.txt");//change to your output file
	
	for( int i = 0; i < 1; i++ )// change the 1 to however many lines you have in your "input.txt"
	{
		
		in >> test1 >> test2 >> test3 >> test4;
		
		lowest = findLowest(test1, test2, test3, test4); //finds and saves lowest
		
		average = (test1 + test2 + test3 + test4 - lowest )/3; //takes average
		
		if( test1 == lowest ) //since you dont want to use arrays this is kinda of long (to me it is)
		{
			out << "Test2 | Test3 | Test4 | Average" << endl;
			out << "  " << test2 << setw(8) << test3 << setw(8) << test4 << setw(8) << average << endl;
		}
		else if( test2 == lowest )
		{
			out << "Test1 | Test3 | Test4 | Average" << endl;
			out << "  " << test1 << setw(8) << test3 << …
sfuo 111 Practically a Master Poster

I fixed up the code so it runs and threw in a few comments.

As GrnXtrm said you have a bunch of errors that mainly has to do with learning the format of a program. I hope my fix up/comments help.

#include <iostream>
#include <iomanip>
using namespace std;

//prototypes
//I changed your getInfo prototype because it was different from the one below
void getInfo(double &spools, double &stock, double &charges); //pass by reference so we do not need to make global variables
void display(double spools, double stock, double charges);

int main()
{
	double spools, stock, charges; //declare local vaiables
	
	getInfo(spools, stock, charges); //sets the variables based on user input
	display(spools, stock, charges); //displays information
	
	system("PAUSE");
	return 0;
}

//declare function outside of other functions(main)

void getInfo(double &spools, double &stock, double &charges)
{
	charges = 0; //sets special charges to 0 (not sure how you really want this done)
	char snh; //
	double chargesSet; //variable for special charges to be added to charges

	cout << "Enter the amount of spools ordered: ";
	cin >> spools;

	while(spools < 1)
	{
		cout << "Enter a number greater than 0: ";
		cin >> spools;
	}
	//you had return here which would stop the function from going any further

	cout << "Enter the amount of spools in stock: ";
	cin >> stock;

	while(stock < 0)
	{
		cout << "Enter a number greater than 0: ";
		cin >> stock;
	}
	//you had return here which would stop the function from going any further
	
	cout << …
sfuo 111 Practically a Master Poster

Sorry for the late reply.

#include <windows.h>

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)
{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&wincl))
    	return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
    	0,                   /* Extended possibilites for variation */
    	szClassName,         /* Classname */
        "Windows App",       /* Title Text */
		WS_OVERLAPPEDWINDOW, /* default window */
        CW_USEDEFAULT,       /* Windows decides the position */
        CW_USEDEFAULT,       /* where the window ends up on the screen */
        544, …
sfuo 111 Practically a Master Poster

I went over this code with the default windows app code generated by dev C++ and I just see lots of errors.

For example:
Line 18: WINCLASSEX ex;
should be WNDCLASSEX ex;

Line 44: ShowWindow(handleWin, SM_SHOW);
should be ShowWindow(handleWin, nshowcmd);

Those are just a few if you want the template I have just ask and I'll post it since it isnt that long.

sfuo 111 Practically a Master Poster

Is this the output you want or that you are just getting? I removed the return that you were having problems with and it matchs those outputs.

sfuo 111 Practically a Master Poster

Post your whole code and I'll try to get it working.

sfuo 111 Practically a Master Poster

From just looking at the code I would say yes that return is the problem because it tells the function to return (do not run anything past this point) before it can recall itself. Other than that I think the code is fine.

sfuo 111 Practically a Master Poster

Here is something I wrote for my friend when he was going to school and it worked for him. I'll leave it up to you to figure out what you need or don't need.

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
	string sentence, word, longest, shortest, charString, wordString;
	int characters, words;
	vector<string>wordlist;
	
	cout << "Please enter some words (ctrl-d or ctrl-z to quit): " << endl;
	
	while(getline(cin, sentence))
	{
		wordlist.clear();
		characters = sentence.length();
		int lastSpace = -1;
		
		for( int i = 0; i < sentence.length(); i++ )
		{
			if( sentence[i] == ' ' )
			{
				word = sentence.substr(lastSpace+1, (i-lastSpace-1));
				wordlist.push_back(word);
				lastSpace = i;
				characters--;
			}
			else if( i == sentence.length()-1 )
			{
				word = sentence.substr(lastSpace+1, (i-lastSpace));
				wordlist.push_back(word);
			}
		}
		
		words = wordlist.size();
		
		switch(characters)
		{
			case 1:
				charString = "character";
				break;
			default:
				charString = "characters";
				break;
		}
		
		switch(words)
		{
			case 1:
				wordString = "word";
				break;
			default:
				wordString = "words";
				break;
		}
		
		for( int i = 0; i < wordlist.size(); i++ )
		{	
			if( i == 0 )
			{
				longest = wordlist[i];
				shortest = wordlist[i];
			}
			if( wordlist[i].length() > longest.length() )
			{
				longest = wordlist[i];
			}
			if( wordlist[i].length() < shortest.length() )
			{
				shortest = wordlist[i];
			}
		}
		
		if( words > 0 )
		{
			cout << "You entered " << words << " " << wordString << " totalling "<< characters << " " << charString << "." << endl;
			cout << "The longest was \"" << longest << "\"." << endl;
			cout << "The shortest was …
sfuo 111 Practically a Master Poster

Not sure how good this is or if it even works since I use windows.

This shows how to make a client and server socket app.
here.

sfuo 111 Practically a Master Poster

I got a mini chat server working using winsock but this only works for windows.

sfuo 111 Practically a Master Poster

For this I would make 3 int vectors: input1, input2, output.

Make a function that reads in a file name and saves it to the vector. void fileToVector(string fileName, vector<int> &in); You would call this twice (once for each file) and then call a function that sorts them into one vector. void mergVectors(vector<int> v1, vector<int> v2, vector<int> &out); Try this out and see where you get with this I would post the whole code but you didn't post any code showing where you are at.

sfuo 111 Practically a Master Poster

If you use new to make it use delete[] to get ride of it.

sfuo 111 Practically a Master Poster

double posted for some reason.

sfuo 111 Practically a Master Poster

I'm pretty sure you can only use that in the form of condition == a ? x = 1 : x = 2;

sfuo 111 Practically a Master Poster

I made some code for this but it is missing a check for the length of input and a newline character remover ( I don't know how you are going to enter a newline character through user input ).

I made 4 functions for this where 3 of them are used in 1 (the main function). See comments.

#include <iostream>
#include <string>

using namespace std;

//makes uppercase to lowercase
void makeLower(string &in, int index)
{
	if( in[index] >= 'A' && in[index] <= 'Z' )
		in[index] += 'a' - 'A';
}
//makes lowercase to uppercase
void makeUpper(string &in, int index)
{
	if( in[index] >= 'a' && in[index] <= 'z' )
		in[index] += 'A' - 'a';
}

//makes 2 or more spaces into 1
void checkSpaces(string &in)
{
	for( int i = 0; i < in.length(); i++ )
		if( in[i] == ' ' && in[i+1] == ' ' && i != in.length()-1)
		{
			in.erase(i,1);
			i--;
		}
}

//checks the string and does the above functions
void check(string &in)
{
	checkSpaces(in);
	bool peroid = true;
	for( int i = 0; i < in.length(); i++ )
	{
		if( (in[i] >= 'a' && in[i] <= 'z') || (in[i] >= 'A' && in[i] <= 'Z') )
		{
			if( peroid )
			{
				makeUpper(in, i);
				peroid = false;
			}
			else
				makeLower(in, i);
		}
		if( in[i] == '.' )
			peroid = true;
	}	
}

int main()
{
	/*
	you can use a char array for getting user input so
	it limits it to 100 characters and then …
sfuo 111 Practically a Master Poster

Make the two classes friends.

sfuo 111 Practically a Master Poster

You need it to be a constant string so try this.

system(("sendmail -options" + EMAIL_TEXT).c_str());

c_str() converts the string into a const char*.

sfuo 111 Practically a Master Poster

I modified your code so that it works the way that you want and changed some of your formatting so it is a bit easier to read.

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
	int game[20][5]; //changed to [20][5] for your total

	for( int g = 0; g < 20; g++ )
		for( int q = 0; q < 5; q++ )
			game[g][q] = 0;
			
	srand((unsigned)time(0));
	
	int randomInteger, g;
	
	cout << "Enter the number of game you wish to update: Game #";
	cin >> g;
	if( g != 0 )
	{
		for( int q = 0; q < 4; q++ ) //you had it so it was just asking for numbers and not doing anything
		{
			randomInteger = rand() % 33; //each quarter is randomly made
			game[g-1][q] = randomInteger;
			game[g-1][4] += game[g-1][q]; //for your total
		}
	}
	while( g != 0 )
	{
		cout << "Do you wish to enter another game to update? If not, enter 0. Game#";
		cin >> g;
		if( g == 0 )
			break;
		for( int q = 0; q < 5; q++ ) //same as above
		{
			randomInteger = rand() % 33;
			game[g-1][q] = randomInteger;
			game[g-1][4] += game[g-1][q];
		}
	}
	
	cout << "Quarter 1	" << "Quarter 2	" << "Quarter 3	" << "Quarter 4       " << "Total" << endl;
	for( int j = 0; j < 20; j++ ) //outputs each quarter and total for each game
		for( int i = 0; i < 5; i++ ) …
sfuo 111 Practically a Master Poster

First off this is the C++ forum and not the C one but I will show you a way of doing it in C++ since I don't know what headers C++ has and C doesn't.

#include <iostream>
using namespace std;

int main()
{
	int input, output = 0;
	cout << "Enter an integer: ";
	cin >> input;
	
	for( int i = input; i > 0; i-- )
		output += i;
		
	cout << output;
	
	system("PAUSE");
	return 0;
}
sfuo 111 Practically a Master Poster

In the future use the code tags to make it easier for us to read.

I compiled this and it ran fine. What did you need help with?

Ace1.0.1. commented: Helpful +0
sfuo 111 Practically a Master Poster

First off you want to call srand() before you use rand() otherwise you will always get the same value for the first random.

Also you can take a look at a snippet I made for allocating memory in a 2 dimensional array. It uses user input and it expands on every input but you only need it once. here.

Or you can just random the 2 numbers (x, y) and after that random you can declare the multidimensional array and then make your for() loop and fill it with random 1s and 0s.

Your random is assigning x and y both the same value (1 or 0). This could result in the array being [0][0]. For making random number you can use this formula num = (rand() % max+1-min) + min; for the size of your array. Then use rand() % 2; for your assignment for each value.

If this doesn't help just ask and I'll write you a quick example for what you need.