how do i stop repeating answers in this? - c++

i am trying to code a family feud type game and I want to know how do I stop repeated answers? like in this code i could keep writing "bugs" and the loop would just carry on.
void f()
{
int y=0;
string q[17];
string ans1[4];
ans1[0]= "bears";
ans1[1]="bugs";
ans1[2]= "snakes";
ans1[3]="skunks";
string ans;
int sum=0;
q[0]="Name something you try to avoid when camping in the woods.";
cout << q[0] << endl;
for (int a=0; a<7; a++)
{
int b;
getline(cin,ans);
if (ans==ans1[0]||ans==ans1[1]||ans==ans1[2]||ans==ans1[3])
{
if (ans==ans1[0])
{
b=42;
cout << "SURVEY SAYS " << b << "! Good Job! " << endl; sum=sum+b;
}
else if (ans==ans1[1])
{
b=33;
cout << "SURVEY SAYS " << b << "! Nice one man! " << endl; sum=sum+b;
}
else if (ans==ans1[2])
{
b=20;
cout <<"SURVEY SAYS " << b << "! Fantastic man!"<< endl; sum=sum+b;
}
else if (ans==ans1[3])
{
b=5;
cout << "SURVEY SAYS " << b << "! You Got it!" << endl; sum=sum+b;
}
}
else if (ans!=ans1[0]&&ans!=ans1[1]&&ans!=ans1[2]&&ans!=ans1[3])
{
cout << "YOU GOT THIS ONE WRONG! "<< endl; y++;
if (y==3) { cout << "LOOOOSER" << endl; break;}
}
}
cout << " your total score for
this round is " << sum << endl;
}

You'd need to keep a list (I'd recommend std::vector) of all the accepted answers. Then, when given a new answer, you'd need to check it isn't in the list.
Alternatively, for each answer, have an wasUsed variable which you check when the answer is given and set after an answer is accepted.

Related

C++ String Array search outputs for every item

I know it's somewhat confusing this title of question but I really need help.
I need to find a string in array with many strings. If the string is not found then the appropriate message is showed. However when I use for loop, it then shows this message for every string in array which is not found although it also shows found string... I hope you understand what I mean and sorry if i'm not making sense. here's my code:
void Store::search() {
string name;
cout << "Enter name of product you're searching: " << endl;
getline(cin, name);
for (int i = 0; i < quantity; i++) {
if (name.compare(database[i].name) == 0){
cout << "-------------<Product found!>-------------" << endl;
cout << "name: " << database[i].name << endl;
cout << "supplier: " << database[i].supplier << endl;
cout << "available quantity: " << database[i].quantity<< endl;
cout << "price per unit: " << database[i].price<< endl;
cout << "------------------------------------------" << endl;
}
else
{
cout << "Product doesn't exist in database!" << endl;
}
}
}
The code works for searching but how do I stop the output "Product doesn't exist in database!" for every item in array that is not found(even when searched item is found)?
Thank You in advance
You can use statement flag:
void Store::search()
{
string name;
bool found = false
cout << "Enter name of product you're searching: " << endl;
getline(cin, name);
for (int i = 0; i < quantity; i++)
{
if (name.compare(database[i].name) == 0){
cout << "-------------<Product found!>-------------" << endl;
cout << "name: " << database[i].name << endl;
cout << "supplier: " << database[i].supplier << endl;
cout << "available quantity: " << database[i].quantity<< endl;
cout << "price per unit: " << database[i].price<< endl;
cout << "------------------------------------------" << endl;
found = true;
break;
}
if (!found)
cout << "Product doesn't exist in database!" << endl;
}
You can also use std::find_if, which will make your code look something like:
auto it = std::find_if(databases.begin(), databases.end(), [&name](const auto &database) {return name.compare(database.name) == 0; });
if (it != databases.end())
{
cout << it->name << endl;
cout << "found" << endl;
}
else
{
cout << "not found" << endl;
}
Generally speaking, C++ offers many such features that more often than not will make your code shorter, improve readability and guarantee functionality
You can:
1. keep a bool variable to be set to true if the item is found in the for loop
2. add a break to immediately exit for loop when item is found
3. remove the else part, because it will print out "Product doesn't exist in database!" for each loop cycle if the item does not match
4. after the for loop, check if found is false to check if item does not exist in collection
bool found = false;
for (int i = 0; i < quantity; i++)
{
if (name.compare(database[i].name) == 0)
{
cout << "-------------<Product found!>-------------" << endl;
cout << "name: " << database[i].name << endl;
cout << "supplier: " << database[i].supplier << endl;
cout << "available quantity: " << database[i].quantity<< endl;
cout << "price per unit: " << database[i].price<< endl;
cout << "------------------------------------------" << endl;
found = true; // set "found" to true
break; // add a break to immediately exit for loop when item is found
}
}
if (!found)
{
cout << "Product doesn't exist in database!" << endl;
}
I assume you want to search a product in the database and print its details if found. Otherwise you want to notify user that the product was not found. If I understood you correctly, then you need to move the else statement out of 'for' loop, e.g.:
void Store::search() {
string name;
cout << "Enter name of product you're searching: " << endl;
getline(cin, name);
bool found = false;
for (int i = 0; i < quantity; i++) {
if (name.compare(database[i].name) == 0){
cout << "-------------<Product found!>-------------" << endl;
cout << "name: " << database[i].name << endl;
cout << "supplier: " << database[i].supplier << endl;
cout << "available quantity: " << database[i].quantity<< endl;
cout << "price per unit: " << database[i].price<< endl;
cout << "------------------------------------------" << endl;
found = true;
break;
}
}
if (!found)
{
cout << "Product doesn't exist in database!" << endl;
}
}
If your database may contain more products with the same name, remove 'break;' statement.
A more "modern C++" approach is to leverage the C++ algorithms (such as std::find_if), lambdas and maybe the auto specifier.
As example (assuming database is a std::vector or some kind of STL container):
auto it = std::find_if(database.begin(), database.end(), [&name](const auto& item) { return name.compare(item.name) == 0; });
if (it != database.end())
{
cout << it->name << endl;
cout << "found" << endl;
}
else
{
cout << "not found" << endl;
}

retrieving int value from void sub function to function in C++

I'm a foundation student who starting to learn coding C++. I'm doing a survey program for my college assignment and after the testing, i found out that the sum value from the sub function cannot sum up properly to the value in main function. any one HELP!!!
here is the code:
#include <iostream>
using namespace std;
int Q1();
int Q2();
int Q3();
int Q4();
int Q5();
int main()
{
char select;
int E, A, C, N, O;
int extroversion=0, agreeableness=0, conscientiousness=0, neuroticism=0, opennesstoexperience=0;
cout << "This is a Self-Esteem Questionnaire." << endl;
cout << "\nInsert S to start the test (Q to Quit): ";
cin >> select;
select=toupper(select);
if (select=='S')
{
cout << "------------------INSTRUCTIONS-----------------" << endl;
cout << "For each statement 1-50 mark how much you agree" << endl;
cout << "with on the scale 1-5, where " << endl;
cout << "1=disagree, 2=slightly disagree, 3=neutral, " << endl;
cout << "4=slightly agree and 5=agree " << endl;
cout << "-----------------------------------------------" << endl;
cout << Q1() << endl;
extroversion+=E;
cout << Q2() << endl;
agreeableness+=A;
cout << Q3() << endl;
conscientiousness+=C;
cout << Q4() << endl;
neuroticism+=N;
cout << Q5() << endl;
opennesstoexperience+=O;
cout << extroversion << endl;
cout << agreeableness << endl;
cout << conscientiousness << endl;
cout << neuroticism << endl;
cout << opennesstoexperience << endl;
}
else
if(select=='Q')
{
cout << "Program quit!" << endl;
}
return 0;
}
int Q1()
{
int E=0;
cout << "I am the life of the party." << endl;
cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
cout << "4=slightly agree and 5=agree" << endl;
cout << "\nRating: ";
cin >> E;
return E;
}
int Q2()
{
int A=0;
cout << "I feel little concern for others." << endl;
cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
cout << "4=slightly agree and 5=agree" << endl;
cout << "\nRating: ";
cin >> A;
return A;
}
int Q3()
{
int C=0;
cout << "I am always prepared." << endl;
cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
cout << "4=slightly agree and 5=agree" << endl;
cout << "\nRating: ";
cin >> C;
return C;
}
int Q4()
{
int N=0;
cout << "I get stressed out easily." << endl;
cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
cout << "4=slightly agree and 5=agree" << endl;
cout << "\nRating: ";
cin >> N;
return N;
}
int Q5()
{
int O=0;
cout << "I have a rich vocabulary." << endl;
cout << "1=disagree, 2=slightly disagree, 3=neutral," << endl;
cout << "4=slightly agree and 5=agree" << endl;
cout << "\nRating: ";
cin >> O;
return O;
}`
Let's start by reducing this problem to its essentials.
int main()
{
int E;
int extroversion=0;
cout << Q1() << endl;
extroversion+=E;
cout << extroversion << endl;
return 0;
}
int Q1()
{
int E=0;
cout << "Give me a number" << endl;
cin >> E;
return E;
}
The problem is that the variable E you have declared in Q1, has nothing to do with the variable E you have declared in main. Therefor when you write:
extroversion+=E;
you are using an uninitialized variable. The solution is to rewrite main as:
int main()
{
int extroversion=0;
int E = Q1(); // Capture the result of Q1 in E
cout << E << endl;// ... *then* print it.
extroversion+=E; // And now you can use the value of E in this function.
cout << extroversion << endl;
return 0;
}
Please note: That "reduced" problem is what you should have posted in the first place - we don't need to see the masses of text, and we certainly don't need to see you do the same thing five times. Remove the verbiage (and check that you still have the problem), and then post the reduced problem.
You're using a truck load of uninitialised variables in main. You are returning values back from the various Q functions, which are being used by the cout calls, but you are not setting E, A, C, N, O in main. Formally this means that the behaviour of your program is undefined.
Replace
cout << Q1() << endl;
with
cout << (E = Q1()) << endl;
and so on, and all will be well. See for yourself by using your line by line debugger.
Let's start from the beginning (which I think your might want to do to learn C/C++, perhaps by running through one of the many online C++ tutorials). I think your main focus should be on the following (in no specific order):
Initialization: Primitive data types like int, char, etc. are called Plain Old Datatypes (POD). In all the cases you are using in your code, they are not initialized, following the rule "don't pay for what you don't use." See What are POD types in C++? for more info.
Scope: Variables exist within a region of a program defined by where they are declared. For example, in main() you declare int E; (without initializing it so it simply acquires the value of whatever was in memory at that location). The scope of this E in main() starts where it is declared at ends at the end of main() (its scope is the function main).. Now we go to your function int Q1() in which you declare int E = 0;. At that point in the function this E comes into existence where it is declared and then goes out of existence at the end of Q1 (its scope is the function Q1). When you set E in Q1 that variable (and its value) disappears when you exit Q1, and so back in main when you add E, you are adding the E declared in main which just has a random value. Thus the E you used in main
extroversion+=E;
is not the same E you set in Q1
cin >> E;
They are different variables.
See https://www.tutorialspoint.com/cplusplus/cpp_variable_scope.htm for more info.
Functions: You are calling functions which return a value, but you don't use that returned value. I think that your misunderstanding of the scope of variables and the concept of a function is the root of your difficulties. Frex, in Q1() you return the value of E, which is indeed what you want. You just didn't know how to use it. In this instance, I would replace
cout << Q1() << endl;
extroversion+=E;
with
extroversion = Q1();
See http://www.cplusplus.com/doc/tutorial/functions/ for more info.
There are many issues with your code above that I think could be rectified by visiting some online tutorials like those I have referenced. I could rewrite your code but I think that (1) it should probably work with the suggestions I have given here and (2) you will learn more if you rewrite it yourself! :-) It also appears to me that you may have just kept adding things in order to get your code to compile that are not necessary. I might suggest that you go through each line and ensure that you understand why it is there (and why it is where it is).

How to prevent repetition of randomly generated options in C++?

Here is what I have done so far, I did my best to label each bit of the code. It should also be noted that this was written in XCode, so it's running on a Mac.
/*
Ayush Sharma
4 November 2016
*/
#include <iostream>
#include <ctime>
using namespace std;
int main (){
//clearing the screen
system("clear");
//seeding the random
srand((unsigned int)time(NULL));
//variables & arrays
char answer;
int r, m, correct = 0;
string capitals[50] =
{"Montgomery", "Juneau", "Phoenix", "Little Rock", "Sacramento", "Denver", "Hartford", "Dover", "Tallahassee", "Atlanta", "Honolulu", "Boise", "Springfield", "Indianapolis", "Des Moines", "Topeka", "Frankfort", "Baton Rouge", "Augusta", "Annapolis", "Boston", "Lansing", "St. Paul", "Jackson", "Jefferson City", "Helena", "Lincoln", "Carson City", "Concord", "Trenton", "Santa Fe", "Albany", "Raleigh", "Bismarck", "Columbus", "Oklahoma City", "Salem", "Harrisburg", "Providence", "Columbia", "Pierre", "Nashville", "Austin", "Salt Lake City", "Montpelier", "Richmond", "Olympia", "Charleston", "Madison", "Cheyenne"};
string states[50] = {"Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"};
//title
cout << "***************************************************************\n";
cout << "* *\n";
cout << "* United States Capitals Quiz *\n";
cout << "* *\n";
cout << "***************************************************************\n\n";
for (int i = 0; i < 15; i++){
//Picking A Random State
r = rand() % 50;
//Checking if State is a Repeat
if (states[r] != "-1") {
cout << "What is the capital of " << states[r] << "? ";
//Picking Correct Answer Choice and Respective Layout
m = rand() % 4;
if (m == 0) {
cout << "\nA: " << capitals[r] << endl;
cout << "B: " << capitals[rand()%50] << endl;
cout << "C: " << capitals[rand()%50] << endl;
cout << "D: " << capitals[rand()%50] << endl;
}
if (m == 1) {
cout << "\nA: " << capitals[rand()%50] << endl;
cout << "B: " << capitals[r] << endl;
cout << "C: " << capitals[rand()%50] << endl;
cout << "D: " << capitals[rand()%50] << endl;
}
if (m == 2) {
cout << "\nA: " << capitals[rand()%50] << endl;
cout << "B: " << capitals[rand()%50] << endl;
cout << "C: " << capitals[r] << endl;
cout << "D: " << capitals[rand()%50] << endl;
}
if (m == 3) {
cout << "\nA: " << capitals[rand()%50] << endl;
cout << "B: " << capitals[rand()%50] << endl;
cout << "C: " << capitals[rand()%50] << endl;
cout << "D: " << capitals[r] << endl;
}
//Recieving Answer
cout << "Answer: ";
cin >> answer;
//Converting Letter to Number
if (answer == 'A' || answer == 'a') answer = 0; if (answer == 'B' || answer == 'b') answer = 1;
if (answer == 'C' || answer == 'c') answer = 2; if (answer == 'D' || answer == 'd') answer = 3;
//Comparing Answer to Correct Answer
if (m == answer) {
cout << "Correct!" << endl << endl;
correct++;
}else{
cout << "Incorrect! The correct answer was " << capitals[r] << "! \n\n";
}
//Removing State from Array
states[r] = "-1";
}else{
//If State was a Repeat, generate another State
i--;
}
}
//Printing Results
cout << "Number Correct: " << correct << "/15 or " << ((correct/15.00)*100) << "%!\n";
return 0;
}
The code works, almost. The problem is that answers are sometimes being repeated, such as in the scenario:
What is the capital of Wisconsin?
A. Madison
B. Frankfort
C. Jackson
D. Madison
Only A or D is the "correct" answer despite both having the same text (altough I'd rather make it impossible for the answers to repeat). I also would like to know if there is a more efficient way to create the layout of multiple choice questions. Thanks in advance!
-Ayush
Given that there are 50 values you want to draw from at random, without repetition, simply create an array or vector containing those values, shuffle it, and then access the elements of the shuffled array in order.
In C++11, this is easy using algorithms std::iota() and std::random_shuffle() from <algorithm>.
int value[50];
std::iota(std::begin(value), std::end(value), 0); // populate array with values 0 to 49
std::random_shuffle(std::begin(value), std::end(value));
Then in your outer loop, instead of r = rand()%50 use r=value[i].
std::begin() and std::end() are in standard header <iterator>.
The same idea can be used before C++11, but the method is a little different (C++11 didn't support std::begin(), std::end() or std::iota(), but equivalents are easy enough to implement).
Instead of value being an array, I'd create it as an std::vector<int>, also with 50 elements. I've illustrated above using an array, since you seem to be defaulting to using an array.
That's a pretty obvious thing to happen. An easy solution would be to make an array to hold the options already displayed. Use a while loop to add unique options to the array.You could check whether there is any repetition in the array using another function. Then, display capitals[r] along with three other options from the array.
bool noRepeat(int arr[], int o){
for(int i=0; i<3; i++){
if(arr[i] == o)
return false;
}
return true;
}
int main(){
...
//picking correct answer and determining layout
int m = rand()%4, n=0, y, options[3];
if (m == 0) {
while(n<3){
y = rand()%50;
if(noRepeat(options, y) && capitals[y]!=capitals[r])
options[n++] = y;
}
//display according to layout
cout << "\nA: " << capitals[r] << endl;
cout << "B: " << capitals[options[0]] << endl;
cout << "C: " << capitals[options[1]] << endl;
cout << "D: " << capitals[options[2]] << endl;
}
//do the same for the rest
...
}
Just like #Isaiah said you can use a while loop to test for the index generated to not be same your correct answer.
Something like :
int index = rand() % 50;
while(index == r)
{
index = rand() % 50;
}
cout << "B: " << capitals[index] << endl;
NOTE: this still can produce repeats of "incorrect answers", but i guess you get the point to avoid the repeats produced by rand. And obviously this is code is just to correct the repeats of corrects answer, you should be using rand at all as mentioned in comments by others.
Your problem is to pick three random capitals without repeats. So here's some pseudo code.
Put all capitals, except the true answer into a vector
Generate a random index into this vector
Use the capital at that index, and erase the capital from the vector
Repeat Steps 2 and 3 for the second and third random capitals. Note the random index should allow for the reduced vector size on each iteration.

C++ assignment help on creating codes for reusability?

I've been having trouble doing this assignment. I'm just having a hard time understanding and I am not entirely sure what to do. I've researched and watched videos and havent been able to find the right, specific information. Its a bunch of questions, so I hope someone can not only giveme the answers, but also explain to me so I have a strong understanding :) . Here are the questions:
1)In this exercise we have been given some program code that will accept two integers as inputs
and evaluate which one holds the larger value. This evaluation occurs in multiple places
throughout the code. Write a function that the program could use to perform this same evaluation
instead of duplicating the code over and over. Start by writing a suitable function declaration
towards the beginning of the code file. You will have to decide whether your function will return
some output or not.
2) With your declaration written proceed to define the function, including the appropriate pieces of
code that will evaluate which of the two integers is the largest. If you stated earlier that your
function will return a value, be sure to define what it will return here.
3) Use your result from parts (1) and (2) to reduce the amount of duplicate code in the main function
provided by replacing the multiple instances of the integer comparison with a call to invoke the
function you have created. Remember that the function will require two integers to be passed in
as arguments and if you are returning some value from the function it should be used (stored in
a variable, outputted to screen, etc.). As a word of advice, test your function works correctly after
replacing just one of the evaluations, don’t replace them all at once (if the function works correctly
for the first replacement then it should work for the others).
4) Since the function you have created only compares the values of its parameters and doesn’t write
to them (i.e. change the value stored in them) we should specify in the function declaration and
definition that these parameters should be treated like constants. Make the necessary
modifications to the function and test again to verify the function still works. Confirm the function
will not let you change the data of the parameters by trying to include an operation in the function
that would change the value of one of the variables (e.g. number2 += 10;)
-- Here is the code ( I apologise for the long writing):
#include <iostream>
int main(void)
{
using std::cout;
using std::cin;
using std::endl;
int nNum1 = 10, nNum2 = 11;
cout << "This program will compare two numbers and report which one is larger.\n\n"
<< "Proceeding with evaluation...\n" << endl;
cout << "\nUsing numbers: " << nNum1 << " and " << nNum2 << ", the larger one is: ";
if (nNum1 > nNum2)
cout << nNum1 << endl;
else if (nNum1 < nNum2)
cout << nNum2 << endl;
else
cout << "Neither of them! It's a draw." << endl;
int numberA = 234;
int numberB = 234;
cout << "\nUsing numbers: " << numberA << " and " << numberB << ", the larger one is: ";
if (numberA > numberB)
cout << numberA << endl;
else if (numberA < numberB)
cout << numberB << endl;
else
cout << "Neither of them! It's a draw." << endl;
int one = 'a';
int two = 'A';
cout << "\nUsing numbers: " << one << " and " << two << ", the larger one is: ";
if (one > two)
cout << one << endl;
else if (one < two)
cout << two << endl;
else
cout << "Neither of them! It's a draw." << endl;
cout << "\nUsing numbers: " << 13 << " and " << 84 << ", the larger one is: ";
if (13 > 84)
cout << 13 << endl;
else if (13 < 84)
cout << 84 << endl;
else
cout << "Neither of them! It's a draw." << endl;
int input1 = 0;
int input2 = 0;
cout << "\nPlease enter a number: ";
cin >> input1;
cout << "\nPlease enter a second number: ";
cin >> input2;
cout << "\nUsing numbers: " << input1 << " and " << input2 << ", the larger one is: ";
if (input1 > input2)
cout << input1 << endl;
else if (input1 < input2)
cout << input2 << endl;
else
cout << "Neither of them! It's a draw." << endl;
cout << "\n\tThank you for running me :3\n" << endl;
return 0;
}
You basically have to refactor the code to replace the duplicate code part in your main function.
If you look closely you will see that code like this repeats:
cout << "\nUsing numbers: " << nNum1 << " and " << nNum2 << ", the larger one is: ";
if (nNum1 > nNum2)
cout << nNum1 << endl;
else if (nNum1 < nNum2)
cout << nNum2 << endl;
else
cout << "Neither of them! It's a draw." << endl;
So put that into a function:
void CompareNumbers(int nNum1, int nNum2)
{
cout << "\nUsing numbers: " << nNum1 << " and " << nNum2 << ", the larger one is: ";
if (nNum1 > nNum2)
cout << nNum1 << endl;
else if (nNum1 < nNum2)
cout << nNum2 << endl;
else
cout << "Neither of them! It's a draw." << endl;
}
And call this in your main function instead of duplicating the said code block.

Printing multiple outputs on same line

there. I'm self learning C++ out of "C++ without fear". There is an exercise dealing with the GCD of 2 numbers that asks to print "GCD(a,b) =>" at each step in the proceedure. I was able to get this working:
int gcd (int a, int b);
int main() {
int i,j;
cout << "Enter the first integer" << endl;
cin >> i;
cout << "Enter the second integer" << endl;
cin >> j;
int k = gcd(i,j);
cout << "The GCD is " << k << endl;
system("PAUSE");
return 0;
}
int gcd (int a, int b){
if(b==0){
cout << "GCF(" << a;
cout << "," << b;
cout << ") => " <<endl;
return a;
}
else {
cout << "GCF(" << a;
cout << "," << b;
cout << ") => " << endl;
return gcd(b,a%b);
}
}
I was just wondering if there is a nicer way to go about printing each step of finding the GCD. That is, is there a "nicer" way to write this part of the code:
cout << "GCF(" << a;
cout << "," << b;
cout << ") => " << endl;
? Thanks in advance.
You can do something like:
cout << "GCF(" << a << ',' << b << ") =>" << endl;
It is not C++ but you could use the C way of printing it which in my opinion looks better in this situation because there are far fewer stream operators, << in the way.
#include <cstdio>
printf("GCF(%d, %d) =>\n", a, b);
But this is a C way of doing things... You could use something like boost::format as is mentioned in this SO answer.
try this one
#include<iostream>
#include<conio.h>
using namespace std;
int main(){
cout << 6+2 <<"\n" << 6-2;
}