Question

i am getting the warning warning: unknown escape sequence: '\s' and warning: unknown escape sequence: '\C'...

i am getting the warning

warning: unknown escape sequence: '\s'

and

warning: unknown escape sequence: '\C'

here is my code

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

int main()
{

ifstream infile;
infile.open("C:\\college\\C++\\scores.txt");
if(!infile)
{   cout<<"could not open";
return 0;
else
string p;
string t;
int s;
string player[6];
string team[6];
int score[6];
while(infile>>p>>t>>s)
{
for(int i=0;i<6;i++)
{
   p=player[i];
   t=team[i];
   s=score[i];
  
}
}
int scoreb=0,scorew=0;
for(int i=0;i<6;i++)
{
if(team[i]=="Blue")
   scoreb=scoreb+score[i];
else if(team[i]=="White")
   scorew=scorew+score[i];
}
if(scoreb>scorew)
{cout<<"Blue team wins with a score of\n"<<scoreb<<endl;
   cout<<"players:\n";
   for(int i=0;i<6;i++)
       if(team[i]=="Blue")
           cout<<player[i]<<endl;
}
else
{cout<<"White team wins with a score of\n"<<scorew<<endl;
   cout<<"players:\n";
   for(int i=0;i<6;i++)
       if(team[i]=="White")
           cout<<player[i]<<endl;
}
infile.close();
return 0;
}
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//Modified code

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

int main()
{

ifstream infile;
infile.open("C:/college/C++/scores.txt");
if(!infile)
{ cout<<"could not open";

return 0;}
string p;
string t;
int s;
string player[6];
string team[6];
int score[6];
while(infile>>p>>t>>s)
{
for(int i=0;i<6;i++)
{
p=player[i];
t=team[i];
s=score[i];
  
}
}
int scoreb=0,scorew=0;
for(int i=0;i<6;i++)
{
if(team[i]=="Blue")
scoreb=scoreb+score[i];
else if(team[i]=="White")
scorew=scorew+score[i];
}
if(scoreb>scorew)
{cout<<"Blue team wins with a score of\n"<<scoreb<<endl;
cout<<"players:\n";
for(int i=0;i<6;i++)
if(team[i]=="Blue")
cout<<player[i]<<endl;
}
else
{cout<<"White team wins with a score of\n"<<scorew<<endl;
cout<<"players:\n";
for(int i=0;i<6;i++)
if(team[i]=="White")
cout<<player[i]<<endl;
}
infile.close();
return 0;
}

Add a comment
Know the answer?
Add Answer to:
i am getting the warning warning: unknown escape sequence: '\s' and warning: unknown escape sequence: '\C'...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I have 2 issues with the C++ code below. The biggest concern is that the wrong...

    I have 2 issues with the C++ code below. The biggest concern is that the wrong file name input does not give out the "file cannot be opened!!" message that it is coded to do. What am I missing for this to happen correctly? The second is that the range outputs are right except the last one is bigger than the rest so it will not output 175-200, it outputs 175-199. What can be done about it? #include <iostream> #include...

  • I need to update this C++ code according to these instructions. The team name should be...

    I need to update this C++ code according to these instructions. The team name should be "Scooterbacks". I appreciate any help! Here is my code: #include <iostream> #include <string> #include <fstream> using namespace std; void menu(); int loadFile(string file,string names[],int jNo[],string pos[],int scores[]); string lowestScorer(string names[],int scores[],int size); string highestScorer(string names[],int scores[],int size); void searchByName(string names[],int jNo[],string pos[],int scores[],int size); int totalPoints(int scores[],int size); void sortByName(string names[],int jNo[],string pos[],int scores[],int size); void displayToScreen(string names[],int jNo[],string pos[],int scores[],int size); void writeToFile(string...

  • Hello, I am working on my final and I am stuck right near the end of...

    Hello, I am working on my final and I am stuck right near the end of the the program. I am making a Tic-Tac-Toe game and I can't seem to figure out how to make the program ask if you would like to play again, and keep the same names for the players that just played, keep track of the player that wins, and display the number of wins said player has, after accepting to keep playing. I am wanting...

  • The following program is in c++ ; I am trying to read in games from a...

    The following program is in c++ ; I am trying to read in games from a file and when doing so I am only reading in parts of the file. It is giving me a segmentation fault error I am going to post my code below if anyone is able to help me debug the program I would greatly appreciate it. The program is too large to be submitted as a single question on here :( --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- void Business::addGamesFromFile() {...

  • Am I getting this error because i declared 'n' as an int, and then asking it...

    Am I getting this error because i declared 'n' as an int, and then asking it to make it a double? This is the coude: #include "stdafx.h" #include <iostream> #include <fstream> #include <string> #include <algorithm> #include <vector> using namespace std; void sort(double grades[], int size); char calGrade(double); int main() {    int n;    double avg, sum = 0;;    string in_file, out_file;    cout << "Please enter the name of the input file: ";    cin >> in_file;   ...

  • I wrote code in C++ that takes a text file containing information on different football players...

    I wrote code in C++ that takes a text file containing information on different football players and their combine results, stores those players as a vector of objects of the class, and prints out those objects. Finally, I wrote a function that calculates the average weight of the players. MAIN.CPP: #include "Combine.h" #include using namespace std; // main is a global function // main is a global function int main() { // This is a line comment //cout << "Hello,...

  • I need to add something to this C++ program.Additionally I want it to remove 10 words...

    I need to add something to this C++ program.Additionally I want it to remove 10 words from the printing list (Ancient,Europe,Asia,America,North,South,West ,East,Arctica,Greenland) #include <iostream> #include <map> #include <string> #include <cctype> #include <fstream> #include <iomanip> using namespace std; void addWord(map<std::string,int> &words,string s); void readFile(string infile,map<std::string,int> &words); void display(map<std::string,int> words);    int main() { // Declaring variables std::map<std::string,int> words;       //defines an input stream for the data file ifstream dataIn;    string infile; cout<<"Please enter a File Name :"; cin>>infile; readFile(infile,words);...

  • I need to make a few changes to this C++ program,first of all it should read...

    I need to make a few changes to this C++ program,first of all it should read the file from the computer without asking the user for the name of it.The name of the file is MichaelJordan.dat, second of all it should print ,3 highest frequencies are: 3 words that occure the most.everything else is good. #include <iostream> #include <map> #include <string> #include <cctype> #include <fstream> #include <iomanip> using namespace std; void addWord(map<std::string,int> &words,string s); void readFile(string infile,map<std::string,int> &words); void display(map<std::string,int>...

  • I want to change this code and need help. I want the code to not use...

    I want to change this code and need help. I want the code to not use parallel arrays, but instead use one array of struct containing the data elements, String for first name, String for last name,Array of integers for five (5) test scores, Character for grade. If you have any idea help would be great. #include #include #include #include using namespace std; const int NUMBER_OF_ROWS = 10; //number of students const int NUMBER_OF_COLUMNS = 5; //number of scores void...

  • Can you tell me what is wrong and fix this code. Thanks #include <iostream> #include <string>...

    Can you tell me what is wrong and fix this code. Thanks #include <iostream> #include <string> #include <fstream> #include <sstream> using namespace std; //function void displaymenu1(); int main ( int argc, char** argv ) { string filename; string character; string enter; int menu1=4; char repeat; // = 'Y' / 'N'; string fname; string fName; string lname; string Lname; string number; string Number; string ch; string Displayall; string line; string search; string found;    string document[1000][6];    ifstream infile; char s[1000];...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT