Saith 74 Junior Poster

Just trying to compile what you have written I immediately get 12 error.

You need to change the section prior to your main(). All the variables and loops need to be placed in main, or at the least in a function.

After deleting the loops and variable declarations etc as mentioned above and fixing a quick syntax error I have found a 'running' program.

The reason why you keep getting 9 is because 9 is the largest number in the array (you sorted it that way, ascending order). "For the most part", you have it correct. Just get rid of your cout in the middle of your for/while loop. Make a for-loop at the end of your program that outputs the array and you will find that you have an array with same elements but in ascending order.

Saith 74 Junior Poster

So one should write like std::cin and such?
Seems annoying / ugly =(
Should I be doing that? (std::), do experienced programmers do that? =(

Yes, you can write like that. I have read a few C++ books and both have been shown. I suppose it comes down to preference, as I am a limited C++ programmer myself, but what you may do instead is sometime similar to this.

/*
	Purpose: thread1529731
	Name: Saith
	Date: 4/8/11
	*/

#include<iostream>

int main() {
	using namespace std;

	int x;

	cin >> x;
	cout << x;

	return 0;
}

The previous code will only use the

using namespace std;

in that block of code so you can continue to use cin without the need of std::cin; but for that block only, if you try to use cin in any other function without the leading std:: the compiler will give an error. Likewise, you may put that namespace in any other block of code and will be limited to that block only.

also I don't quite understand your swap function >.<
Shouldn't you do swap(&x, &y) iny our main function?

There is a swap function in the std. The compiler will use the std function swap() that takes two arguments and swaps the values for each.

The only time you need to use the & for call-by-reference is when you are -declaring- a function and when you are -defining- a function, you -do not- need the & when …

Narue commented: Props for showing namespace directives in a nested scope. +25
Saith 74 Junior Poster

Yeah, you can't do that with the while loop.

while(choice != A && choice != B && choice != C ... etc)

OR you can write it as

while( choice < 1 || choice > 4)
// basically read as, while choice is less than 1 or greater than 4, do this again
// Meaning, not 1 or 2 or 3 or 4
Saith 74 Junior Poster
rational rational ::operator +(rational r){


rational sum;
sum.numerator =numerator+sum.numerator;
sum.dnomenator=dnomenator+sum.dnomenator;
cout<<"The sum afer adeng both fraction  is  :"<<endl;
return sum;

}

Few things wrong with the logic of this.
1. You need to add two separate objects together, not one object and the sum of two objects.

Ex.
You want A + B = C
not A + C = C

This is shown with both additions in the previous code.

2. You need to find a common denominator between both fractions. If they are already equal, then you can just add the numerator and KEEP THE SAME denominator. If both denominators are different, you need to find a common denominator, then change the numerators respectively prior to adding the numerators.

Finally, you can use your reduction function to simply your answer.

Saith 74 Junior Poster

// Example - rational is a class name not shown but defined else wherefriend rational operator+(const rational& var1, const rational& var2){<some code>}

What I wrote above is wrong with this set up. It is correct that the + operator only takes one argument, not two. The first argument is actually the variable on the left side of the + sign in the equation between the two objects. The second variable is the one that is passed which is on the right side of the object.

A + B // A is the first argument, B is the second which is passed to the function.

The reason why you want to overload an operator to a class is due to the unknown variables you actually want to add. You will specify which variables to be combined into a -new- object, the returned object.

// class
class stuff{
public:

  <some other functions declared>

   // declared friend operator 
   friend stuff operator +(const rational& obj);

private:
   int var1;
   int var2;
};
// declared function

stuff stuff::operator +(const rational& obj){
   stuff temp;    // will create a new object of type stuff to store the sum

   // we will add the two objects together with the desired variables and 
   // save them in the new temp object.

   temp.var1 = var1 + obj.var1;
   // in the example of A + B, var1 is referenced to A, 
   // and obj.var1 is referenced to B.

   temp.var2 = var2 + obj.var2;
   // in the example of …
Saith 74 Junior Poster

Please reread what I wrote, then check your answer with mine. Do they look similar? Do they have the same amount of parameters? You also declined to add the friend function declaration in the class definition, without it, the class will not know where to look for the + operator.

Here is a quick tutorial that should help with your needs.

http://www.cplusplus.com/doc/tutorial/classes2/

Saith 74 Junior Poster

any could help me ??
thanks

How about... You start your own thread?

Saith 74 Junior Poster

Instead of system pause, I'd recommend something easier on the system itself.

cin.get();

It's basically - "Press and key and <enter> to continue..."

Saith 74 Junior Poster

To add overloading operators to a class definition, you need to add them as a FRIEND function.

friend <type_name> operator <operator>(const <type_name>& var1, const <type_name>& var2)

// Example - rational is a class name not shown but defined else where
friend rational operator+(const rational& var1, const rational& var2){
<some code>
}

Would be how you would define a friend operator function. The difference between a friend function and an ordinary function that are defined in a class, the friend function is not a calling function from any one particular object but may be used for one or more objects (unary operation, binary operation)


Once you figure out how to overload the + operator, you can overload the << operator instead of using the show() function.

friend ostream& operator << (ostream& outs, const rational& object);
//Precondition. If outs is a file, outfile has been opened.
// Object have been given a value. Will output object members to outs ostream
}
Saith 74 Junior Poster

The code you posted would indicate that fourvector is a class derived from the class threevector. The constructor of fourvector simply forwards the one_two_three parameter to its base class constructor.

Remark: "I have seen this syntax used for the constructor of the fourvector:"
Run! Just run away from this code! There are so many things that are wrong with it that its not worth wasting time correcting it. Just run, before it poisons your mind.

Funny that you mention that. I think I have seen this type of example somewhere from a -textbook-. Kind of "funny" (being facetious) that a text book would give a bad example as the one you are saying to run away from.

I suppose this wouldn't be the first time I've head of this occurring. Difference between what you "can do" and what you "should really be doing".

Out of curiosity, why would this set up be so bad?

Saith 74 Junior Poster

I'm sure you can write a function that will do that for you without needing an entire program.

Please show some work.

Saith 74 Junior Poster

vmanes sir one more thing did i used the constructor for the p2 correctly ?

If you are asking about the declaration of your objects to your class as such

phone p1,p2(a,b,c);

Then yes, you can give values of a, b, c with this constructor. Problem occurs when compiling, "What are the values of a, b, c, and are they integer values, character values, what is the data type you are looking for?".

You need to state what the data type is and how you will get those values into the constructor when the object is being initialized.

A. Already have inputted variables, such as

phone p1,p2(1, 2, 3);

B. Have the main program require the user to input variables,

int a, b, c;
cout << "input numbers" << endl;
cin >> a >> b >> c; 
phone p2(a,b,c);

This is basically a rephrase of what Vmanes was suggesting. You will also need to edit what Vmanes had suggested about the structure of your class definition. If you can copy and paste what you have now and any errors you can't figure out, we may be able to help you more along.

Good luck with your programming club.

Saith 74 Junior Poster

I can see why you wanted to use your MAIN() in the first instance.

if(choice<0 || choice>4){
        cls();
        main();
    }

If the selected choice is not valid, just restart the program. Instead of restarting the program, just ask the user to "try again" with a more valid input.

do{
<some code>
while(some input is not valid);    // if invalid, do again; else continue past the while statement

You may want to revisit while,do-while,for loops again. Once you have this working correctly, you can "basically repeat this" for another other main() you had when dealing with invalid input.

Saith 74 Junior Poster

Neither do I, really. I don't see how a random number should be existing in this loop, and then an X value to be returned. I can understand if you want to compare X > Y and change the while expression to

while (x / 53.0 > y);

so that a more valid x is returned when compared to a y value.


(With the original while loop). Imagine if the first loop, x was 50 and the random expression in the while (1 > .6), the loop would go again. Say by happenstance, x was 50 (again) and the random expression in the while loop was now (.6 > 1). The statement would turn false and now you would return x with value 50. To me this seems like a logical error. Granted, I don't know much more of what is going on other than the code that was given.

If the while loop was changed to

while (x / 53.0 > y);

x = 50.0 and then in while statement you'd get (50.0/53 > y), I can then understand why you would return the x value from the expression of the y value.

You may also want to check out this for Probability Distribution on wiki.

http://en.wikipedia.org/wiki/Cumulative_distribution_function


Finally, I could easily be wrong right from the get-go. I have never taken statistics but would be interested in seeing the answer.

Saith 74 Junior Poster

You can create a namespace for all of your classes and then add that global variable in that namespace.

You may consider changing your constructors to your classes to add an additional parameter. As the class is created that variable will be used as a parameter that you can share between all classes.

P.S. Nathan seemed to beat me to it.

Saith 74 Junior Poster

Remember cin.ignore has two parameters.

cin.ignore(1000, '\n');

This is to clear the input stream useful with while mixing cin.get(param1) and cin >> variable1.

Example 1

/*
	Purpose: threads/354626
	Name: Saith
	Date: 3/20/11
	*/

#include<iostream>
using namespace std;


int main(){

	int var1;
	char var2;

	cout << "Input some number.\n";
	cin >> var1;
	cout  << "Your number is "<< var1 << endl;

	cout << "Input another number.\n";
	cin.get(var2);
	cout  << "Your number is "<< var2 << endl;

	return 0;
}

Input:
1
// c // would have been the second input

Output:
1
[blank space]


and will not bother pausing for a keystroke due to a character already in cin (the '\n' character). If you add the cin.ignore(para1, para2); syntax, the '\n' character will be removed from the stream input along with any other value.

Example 2

/*
	Purpose: threads/354626
	Name: Saith
	Date: 3/20/11
	*/

#include<iostream>
using namespace std;


int main(){

	int var1;
	char var2;

	cout << "Input some number.\n";
	cin >> var1;
	cin.ignore(1000, '\n');
	cout  << "Your number is "<< var1 << endl;

	cout << "Input another number.\n";
	cin.get(var2);
	cout  << "Your number is "<< var2 << endl;

	return 0;
}

Input:
1
c
Output:
1
c

Ancient Dragon commented: Nice :) +36
Saith 74 Junior Poster

Learning takes practice, practice takes time. You need plenty of both to get far in anything you do. If this will be anything like your previous posts under the similar name, spoonlicker (not the current spoon_licker), the chances of you getting any type of positive feedback will be minimal.

I would recommend something very simple in the tutorials and try to understand what is going on, line by line. If you have a hard time doing that, it will be increasingly difficult to manage the more "complex" stuff. Once you get the tutorial actually working, then I would recommend changing any code in the tutorial and see what the result is. If there is an error, change it back and find out why the error occurred. Play with it and then ask a specific question about what is wrong with the current code, or how else can you mess with it.

I know this isn't answering your question to the degree that you may "want" but you need to keep on pushing the instructional books and -THEN- come in with specific questions before we get too serious in answering your question.

Saith 74 Junior Poster

yea, i ignored your help, because you did not help me with my code at all, and I did not know what I needed to take out. All I read was advice, NOT HELP. SO I did believe you, you just did not help me.

He is trying to help you out. By making you think. You are doing a good job by attempting the code and working around his advice. Keep at it.

This is a program for my homework assignment and I have been working on it for nearly 8 hours. Could you please just show me in my code what I need to take out. PLEASE.

Showing the answer is just doing your homework. Try to take the 'advice' (which is help) that WaltP is giving you and work with it. Just "finally giving you the answer" will not "help" you or your grade in the long run.

Funny too, I just replied in your newest post prior to reading this one and I did the same attempt WaltP did. Please read our suggestions as they are a direct answer to your question in non-syntax form.

Saith 74 Junior Poster

You may want to actively step by step debug this with your IDE. First comment out all functions so none are being called or compiled. Take the first function and debug it until it works properly, then un-comment the next function and debug it until it works properly. Do so until all functions work properly.

Debugging is half the fun of actual writing programs; not staring off into spacing hoping it fixes itself.

void tagReader (ifstream& inFile, int&count)
{    
     string cylinder, serial;
     double num1, num2;
    
     inFile >> cylinder;
         while (!inFile.eof()) 
         {
         inFile>> serial;
         inFile >> num1;
         inFile >> num2;
         cout << fixed << showpoint << setprecision(2);
         cout <<"\nCylinder: " << cylinder << " " << serial << " " << num1 << " " << num2 << endl << endl;   
         count = 0;
         count++;
         while (!inFile.eof())
         {     inFile >> cylinder ;
               inFile >> serial;
               inFile >> num1;
               inFile >> num2;
               cout << "\nCylinder: " << cylinder << " " << serial << " " << num1 << " " << num2 << endl << endl; 
               count++; 
         } 
        }
}

Your function here, doesn't seem right. You are calling a while loop inside of a while loop that appears to be doing the same thing. You may only need the first while loop to do the job you are looking for.

You also have the two statements

count = 0;
         count++;

Every time you loop through, you are resetting your count(er) to zero, then immediately adding.

Saith 74 Junior Poster

You need to read this thread. It will explain why you are having the error with the string input and it's function.

http://www.daniweb.com/forums/thread90228.html

~~~~~~~~~~~~~~~~~~~~
For the while loop, I just explained it in a very detailed fashion.

~~~~~~~~~~~~~~~~~~~~~
Lastly, check out your expressions such as (60 <= average < 95). You can't do this with the expected results of normal arithmetic. You need to change this to (60 <= average && average < 95)

Saith 74 Junior Poster

NathanOliver has a good point, just a for-loop.

Just in case you haven't done for-loops just yet, you can do basically the same thing with a while loop. Ask for the number of students, create an index for the current loop count, then increment the index once the loop ends. If the index is less than or equal to the amount of students, do the loop again; else the loop ends.

Saith 74 Junior Poster

Luckily, us "smart ones" (really the ones that truly want to find the answer by digging for it) will filter through those kind of responses and will find what we are looking for.

I've been a Daniweb member now for ~2 months, ~2 months longer than any other forum, and I still consider this a very reputable site in so far as to searching this forum prior to any other and spending my time to help others.

No matter where you go, there will be good and the bad. Seems like this site does a good job filtering those bad down to a minimum. I say keep up the good work to the admin's and keep up with the great responses to those that are giving positive criticism.

AndreRet commented: Agreed! +0
Saith 74 Junior Poster

First, as Crutoy as responded, you want to populate the array.

Use nested for-loops. A generic one you may find would include something similar to this.

/*
	Purpose: thread347853 - filling a multidimensional array
	Name: Saith	
	Date: 2/17/11
	*/

#include<iostream>
using namespace std;


int main() {

	const int vertical = 2;
	const int horizontal = 2;
	int list[vertical][horizontal];

	for(int index = 0; index < vertical; index++){		// will fill your array vertically
		for(int index2 = 0; index2 < horizontal; index2++){		// fill your array horizontally
			cout << "Please input [" << index << "]["<< index2<<"]" << endl;
			cin >> list[index][index2];
		}
	}
	cout << "OUTPUT "<< endl;
	// And to output them, you would do the same thing.

	for(int index = 0; index < vertical; index++){		
		// will output your array vertically

		for(int index2 = 0; index2 < horizontal; index2++){		
			// output your array horizontally
			
			cout << list[index][index2] << " ";
		}
		cout << endl;		
		// as the index increases (vertically) a new line will be make for the next set of numbers
	}

	return 0;
}

If you compile and test this code, it may help you understand how/why multi-dimensional work. You can really cut down on the amount of coded lines. Imagine, if not 10x10 but 1000 x 1000, trying to code in for each possibility. Yeah. Good luck on that one! Good luck to you on this current project.

-Saith

Saith 74 Junior Poster

Also, with a switch statement. The code will continue to run until a break statement is found or until the end of the switch statement. You do not need additional brackets except the overall brackets that made the switch code block.

switch(c){    // beginning of switch code block

case 1: 
   dothisfunction();
   break;
case 2:
   dothatfunction();
   break;
default:
   cout <<"What are you doing?\n";
}      // end of switch code block
Saith 74 Junior Poster

No. You can declare variables in the main function.

int main() {

int a, b;


<rest of program here>

return 0;
}

Switch statement is a "flow of control" like the if-else statement, while loop, for statement, etc.

Saith 74 Junior Poster

cout << Accelerate(first) << endl;

The cout implies that you want to output something using the function, Accelerate.

The function Accelerate, when you called it Accelerate(first), does not take any parameters in the declared or defined function. Nor does it imply outputting any data either.

void Car::Accelerate(){
Speed = Speed + 5;
}

So, do you want to increase the speed? or cout the speed?

Saith 74 Junior Poster

Odd though, I just created this. It gave me no linking error >< Even with a char passed to an int

Saith 74 Junior Poster

Because you are passing a char to a int variable.

Saith 74 Junior Poster

Well its O.K. if its not in a header file where we can assume things like the user will use things like 'using namespace std;'

Being the newbie that I am. I can't say that is true. I had "using namespace std;" in the implementation AND application file but NOT in the header file as I attempted to build the project without the std:: preceding vector<int> v1;. I got an error.

I included the std::, the error resolved. I removed std:: and included "using namespace std;" and the error was resolved.

Saith 74 Junior Poster

Okay, to use

vector<int> v1;

without the need of the preceding std::, you need to include the

using namespace std;

at the beginning of the header file, else std:: will be required.

Saith 74 Junior Poster
#ifndef SSASSG1_H
#define SSASSG1_H

#include<vector>

class NumberSet
{
      public:
             NumberSet(int array1[]); //transfers the data from an array to a vector
             NumberSet( ); //default constructor
             int array_size_horizontal;
      private:
		  std::vector<int> v1;
              int vectorsize;
};
#endif
Saith 74 Junior Poster

scratch that. I just rebuilt it again after no errors, and vector<int> v1; gave me an error.

So, I tried std::vector<int> v1; again. The only error after that was asking me to put a
#endif at the end of the HEADER file

Saith 74 Junior Poster

I copied and pasted what you had.

The only solution I came up after compiling with no errors is:

#include<vector> in the header file

Oh, and get rid of
std::

in

std::vector<int> v1;

So its just

vector<int> v1;

Saith 74 Junior Poster

I'm not sure if I'm misinterpreting your question, VernonDozier. The array isn't really passed to the function, really a pointer to the first location of the array; technically, it's not pass by value or pass by reference. Arrays are funny like that.

But yes, overall, I'm very new to recursion myself. Seems like a sketchy set up as is.

Saith 74 Junior Poster

First, do what jonsca suggested by creating a new variable, adding to the variable of the current grade to get a running total of all grades added together, then divide by NUM_SCORES (sum)/NUM_SCORES will give you your average.

To extend on that, you will need to add an additional for-loop to get the average from the students that you did not initially input from the user. That for loop will sum all the grades together as I explained earlier and then again, divide by NUM_SCORES. You can make a local variable to save the averages for each student, or add a member function to the original structure, Student.


You may also make a function to pass as an argument the student object so that you don't have to rewrite the function three times, or as many student as there are. You just have to create the function once, then call the function as many times as you want to, no matter how many students.

Saith 74 Junior Poster

Oh, this will happen with for-loops as well.

for(int index = 0; index < 10; index++);
{
cout << "hello world";
}

The for-loop will run 10 times, but it will not process the block of code 10x as we expect. The semi-colon is preventing the block of code to output hello world the 10x we expect it to. By getting rid of the semi-colon, you make the following block of code part of the for-loop body; the block executing every time the for-loop loops.

Saith 74 Junior Poster

What happens when you add the semicolon at the end of the if-statement, the if statement checks to see if the statement is true or false. It ends there. The block of code following the if-statement is interpreted as a new block of code, regardless if the if- statement was true or not, that will run.

/*
	Purpose: The semicolon at the end of the if-statement
	Name: Saith
	Date: 2/5/11
	*/

#include<iostream>
using namespace std;

int main() {

	if(4 > 5);   // we know this is false, but will run the following block of code anyway
	{
	cout << "hello world";
	}
	return 0;
}

Is a snippet of full program that will output hello world.

Saith 74 Junior Poster
// Original
if(begllts <= intarray[m] && intarray[m] <= endllts);

// Akill10 changed to
if(begllts <= intarray[m] && endllts >= intarray[m])

is the same exact thing. No difference, other than Akill10 got rid of the ; at the end of his if-statement.
Saith 74 Junior Poster

OH
I see

check your IF STATEMENT.. GET RID OF THE ;

if(begllts <= intarray[m] && intarray[m] <= endllts); //<--- that last ;, Get rid of it BAD, NEWBIE BAD .. :D

Akill10 commented: well spotted!! +1
Saith 74 Junior Poster

Okay. I just compiled your code and debugged a bit. The reason why are getting an error when running your code is due to the divide by zero effect. It's GG.

You are wondering why numOfClasses = 0 by the time you call the second function, it's because numOfClasses actually equals zero.

Why? Because in the first function, you passed the value argument, pass-by-value, and not pass-by-reference. You told the function that numOfClasses equals 3 through cin, but that assignment to numOfClasses was only valid in that functions block of code. Once the block ends, numOfClasses value is now wiped and replaced by the value prior to the function call, zero. Making all the parameters for that first function, pass-by-reference, you will save those variables past the end of the block from the function. You will also need those variables saved past that first block to be used in the third function.

Also, in your third function, the output function to the screen with the final results. There are no syntax errors, but there are logical errors. Your output of letter grade outputs the LAST LETTER GRADE entered. NOT the average letter grade. So if you inputted A, A, C. Your letter grade is C, which should be B.

Also, for -just in case-, you want to equate totalPoint to zero prior to using totalPoints += qp; as it also means, totalPoints = totalPoints + qp; and if there is some random junk from a previous …

jonsca commented: Good explanation, thanks for not just giving the code to the OP +6
Saith 74 Junior Poster
//Prototypes being used:

void userData(string, int, char);

double calData(int, int, int);

void displayData(string, char, double);


// You need to change your function declaration of calData to two arguments, not three
Saith 74 Junior Poster
/*
	Purpose: Have user input lines of code until sentinel value has been found. Output results
	Name: Saith
	Date: 2/4/11
*/

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


int main() {
	
	string line, paragraph;		// strings are initialized as empty, no need to assign them.
	
	while(line != "done"){
		paragraph += line;
		cout << "Enter newest line.\n";
		getline(cin, line);
	}
	cout << paragraph;

	return 0;
}

Here is a sample that I just created using user input.

Saith 74 Junior Poster

call the function multiple times.

If you are reading the input from a file, you can run a while loop that checks for EOF.

If you are reading from user input, make a sentinel to end the while loop.

while(string_name != "Done"){ // or change the string to whatever you want, "Exit" "Finished", "0"
<some code here>
}

Saith 74 Junior Poster

You don't need to have the data type when calling your function in the main() function.

int main()
{
	//called functions
	userData(string studentName, int numOfClasses, char letterGrade);
	calData(int totalPoints, int numOfClasses);
	displayData(string studentName,char letterGrade, double gpa);
	getch();
	return 0;
}

You also need to initialize totalPoints to zero prior to calling it for the first time. You can debug the code with break lines and then check what your local variables equate to line by line.

Saith 74 Junior Poster

You also may want to make functions for each of the cases.

case '1':
      first_function(Parameter_list);
      break;
case '2':
      second_function(Parameter_list);
      break;
default:
      break;
}

void first_function(Parameter_list){
<code>
}

void second_function(Parameter_list){
<code>
}

makes it cleaner, you can also use this code outside of the switch statement.

Saith 74 Junior Poster
#include <iostream>
#include <string>
using namespace std;

void daysOfChristmas (int days, char switcher, string b[12]){
	(days > 0 && switcher == 'y') ? daysOfChristmas(days - 1, 'y', b): false;

	if (days > 0) { 
		daysOfChristmas(days - 1, 'n', b);
		cout << "on the " << days << " day of Christmas my true love gave me " << b[(days-1)] << endl;
	}

}
int main() {
	string gifts [12] = {
		"a partridge in a Pear Tree", 
		 "two turtle doves", 
		"three french hens", 
		"four colly birds", 
		"five golden rings", 
		"six gees-a-laying", 
		"seven swans-a-swimming", 
		"eight maids a miliking", 
		"nine ladies dancing", 
		"ten lords a leaping", 
		"eleven pipiers piping", 
		"drummers drumming"
	};

	daysOfChristmas(12, 'y', gifts);
}

It appears that is the formatted code we were looking for. I compiled the code and all seems to be running without errors.

It looks like you are trying to use recursion. I tried, but I'm not sure if this is what you are looking for. Instead of continuously checking to see if 12 was reached by a boolean expression, or otherwise, y/n char variable, I just iterated the function, each time used a for loop to reduce the CURRENT DAY down to 1 and spammed cout for each string in the array. May not be the approach your professor was looking for.

It was good practice for the both of us. I just started learning recursive functions about 5 hours ago. Let me know if this is acceptable by your professor/teacher. Even …

Saith 74 Junior Poster

As Nandomo suggested, you need to use strncpy. You are using the char arrays as C strings, and as such, they use a different method than normal char arrays, or even strings.

It would be easier if you just changed all the types (chars) to string. So you'd have

struct Customer{
	string caName[kiCharSize];
	string caSurname[kiCharSize];
	string caCity[kiCharSize];
	string caPhone[kiCharSize];
	string caDate[kiDate];
	string cDay;
	string eDay{M,A};
	string caBrand[kiCharSize];
};

// instead of what you currently have:

struct Customer{
	char caName[kiCharSize];
	char caSurname[kiCharSize];
	char caCity[kiCharSize];
	char caPhone[kiCharSize];
	char caDate[kiDate];
	char cDay;
	enum eDay{M,A};
	char caBrand[kiCharSize];
};

By changing from C string to string, you can keep your assignments in your constructor the same and still be able to manipulate the string using element access like you do in arrays.. Guessing as how you are using this as a class work, or book work, you will be likely be sticking with the char type.

The char type, as you have written, is a C string. As such, to equate a C string array to the desired string, you need to use the C string function:

strncpy, which takes 3 arguments.
strncpy(Variable, string, array_limit);
example:
Cust.caBrand="HolyBrand"; would be changed to

strncpy(caBrand, "HolyBrand", kiCharSize);

And seeing how this is implemented in a CLASS CONSTRUCTOR, you do not need the dot (.) operator.

The most likely of times when you need a dot (.) operator in a class member function is when you passed an OBJECT …

Saith 74 Junior Poster

The nested for loop is what you are looking for. You will use nested for loops once you get into array of arrays.

void buildSquare( int length, char symbol){
// Length = Length x Length to make the box
// Symbol will be used to make the box
// The for loop nested inside a for loop help creates 

            // this first for loop will be used for the vertical length of the box
	for(int side = 0; side < length; side++)
	{
         // this second for loop will be used to create the horizontal length of the box
            for(int side2 = 0; side2 < length; side2++){
		cout << symbol;
            }
            cout << endl;
	}
	
}
Saith 74 Junior Poster

Good luck trying to contact Mr. Bill for that answer.

I suggest googling it. As I just did,

http://www.makeuseof.com/tag/5-ways-to-make-your-own-screensavers-windows/

Question? How is this related to C++? If you have any program that you would like use to look at, I know I would be interested in seeing any progress you've made.

Saith 74 Junior Poster

Please show us what you have done so far. Paste in some code, show some work, and we can then help you.