*edit*
Nevermind, it looks like I just needed to add a backslash:
found = str.find("\\n");
----------------------------
I'm searching for a sequence of characters in a string. I figured...
Type: Posts; User: Cpro
*edit*
Nevermind, it looks like I just needed to add a backslash:
found = str.find("\\n");
----------------------------
I'm searching for a sequence of characters in a string. I figured...
That fixed it. I guess I still had it set to the Unicode setting when I added the astrisk the first time.
Thanks for your help.
Hi. I'm trying to access the file names of all the files in a folder. I am trying to use FindFirstFile to do this. However, I'm having some issues.
void TestFunction()
{
string...
Perhaps, but maybe it was wanting the reader to actually implement that part themselves; who knows.
...
input>>word;
cout<<word<<endl;
input.clear();
input.close();
input.open("meaning.txt");
...
Try adding input.clear(); This should fix the problem. This kind of explains it, although,...
Well, you are already prompting the user for more information; you just need to write it to the end of the file.
Here is how I wold go about it:
Move the for loop out of the while loop (if you...
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int main() {
int c; // input character
int i; // loop counter
char filename[81];
char...
#include <iostream>
using namespace std;
double payRate;
int hours;
class Employee
{
public:
void set(double payRate, int hours);
Just ask the user after the string is filled, right before the next key iteration (where my comment is). If it is the correct string, break from the for loop. Then the return statement executes,...
After the function definitions...
Function calls...
It looks like most of the work is done, and you just have to call the functions. I suspect these functions were already provided for you,...
The following works for me ("number" is the key value and is set to 2):
#include <iostream>
#include <vector>
#include <cstdlib>
#include <string>
#include <fstream>
using namespace std;
What exactly are you trying to do with the key loop? The program should be working now.
A couple things:
-Some of your plus & minus symbols in the for loop are switched around.
-You have no if...
Ah, I think I understand now. So, when it hits 127, it is suppose to go back to 32 and add what was left over. In that case, your if statement is justified:
if (int(encrypted[i]) + key > 126)
...
I'm not sure that makes sense. Could you please clarify.
string decode(vector <char> encrypted, int key)
{
string decode;
int size = encrypted.size(), i = 0;
for (i; i < size; i++) {
for (key = 0; key < 100;...
It believe it should look like the following:
#include <iostream>
#include <string>
using namespace std;
struct car
{
int TimesShoot;
cin>>TimesShoot;
float avgarray[TimesShoot];
How is this possible? I didn't think an array could be created like that, since TimesShoot is not a const.
I thought you had to do...
if(ball_y <= 0){
if(ball_direction == 2){
ball_direction == 3;
}
if(ball_direction == 5){
ball_direction = 6;
}
}
Are you having the issue only when you are in the game or always?
I'm assuming the touchpad has a separate driver associated with it (mine does). You could try updating/re-installing it. I doubt it...
The method BuzzBuzz suggested is probably the best way to go about it. But, just to give you another option...
You could have the word stored in an array, and compare the characters until all have...
How does "cin >>" not accept ","?
Example:
cout << "Please enter your name (last, first): " << endl;
cin >> lastName;
cin >> firstName;
cout << lastName;
Could you further explain what you mean by adding a counter. Are you just wanting to time how long the program ran or something else?
Also, what specific problems are you having implementing it?
The comma after the last name is what makes it a bit more difficult. If there was no comma (just a space), you could just do:
cin >> lastName;
cin >> firstName;
cout << firstName << " " <<...
Perhaps you could use a two dimensional vector, using a struct to hold different types of data.
"but im a bit confused about how to get Count_space.fail() worked in?"
Well, you don't have to use it. It just depends on how you make your while loop. This is how I did it:
while(1)
{
...