I want to search the numbers for the Index number of 1154
The search will return a True if I can find 3 or 4 same digits between the Index number and the 8 numbers
The search also have the following criteria -
meaning that -
1154 when compared to 1154 == true
1154 when compared to 1179 == false
1154 when compared to 2154 == true
1154 when compared to 2554 == false
1154 when compared to 2484 == false
1154 when compared to 2144 == false
1154 when compared to 4515 == true
1154 when compared to 1144 == true
1154 when compared to 1517 == true
1154 when compared to 4815 == true
1154 when compared to 1481 == true
the index number can also be of type - 1234, 1123, 1112, 1111
I am trying to figure out how to go about comparing two strings of numbers. I have two files that both contain numbers 1-50, one file has multiple repeating numbers while the other one just has 1-50.
I want to compare the files and count how many of each number a occurred and make a chart with * next to the number. First I figured I would use the strings like an array and compare them using nested loops. Then I noticed I have single and double digit numbers. The numbers in the files are printed as:
1 44 5 34 4 2 22 7 55 4 ...... etc
Compared too: 1 2 3 4 5 ...... 50
I thought about using string stream and converting the string to int but wouldn't it just be a huge number when set to the int variable? Then I thought about a array initialized with 1-50 and compared to the file but I still have the issue with single and double digit numbers.
My question is how can I just read one number at a time, either double or single digit?
I have two char* that have the same data in (hypothetically).
std::vector<char*> Buff; Buff = Split(Line, '.'); char* A = "data", B; B = Buff.at(0)
Where Split is a function that I made to split a string (Line in this case) into a char* vector, this string contains a line from a file. Line is char* too. The weird problem is when Buff data stored in its 0 position is given to B... because B is equal to A (hypothetically) but when this is compared to do certain functions they doesn't match!
Here an example:
std::vector<char*> Buff; Buff = Split(Line, '.'); char* A = "map", B; B = Buff.at(0) // Buff.at(0) should be "map" and is apparently "map"
[Code].....
NOTE: I didn't use switch to compare Cmd because I want it separately for easier debugging.
Is there something wrong with my codes?? or what happened here with those hex values before the string in my variables?
std::string str = "Hello"; std::string phrase = "Hello world"; std::string slang = "Hiya"; and i have these two rules to compare 2 strings object :
if two strings have different lenghts and if every character in the shorter string is equal to the corresponding character of the longer string, than the shorter string is less than the longer string.
if any characters at corresponding positions of two strings differ, then the result of the string comparison is the result of comparing the first character at wich the strings differ then my book says : if we apply the rules of the comparison we know that phrase is greater than str( ok i've understood this ) and that slang is greater than both slang and phrase ( why ?)
explain me rule number two ? in phrase and slang the characters differ and the first character that differ is not H so why my book says slang is bigger than phrase ?
i have been trying to compare a date format from SYSTEMTIME and a date from a text file(string).But its not working. I tried to change both to string(using osstringstream),char* and int(using sscanf) to do the comparison but with no luck. its pretty simple all i want to do is get the current system date and compare it with the date from the text file. Below is my code:
char szcurrentDate[MAX_PATH] = ""; char szdate_time[MAX_PATH]; SYSTEMTIME st; GetLocalTime (&st); GetDateFormat(LOCALE_USER_DEFAULT,NULL,&st,"yyyy-M-d ",szcurrentDate,MAX_PATH); //current system date //std::ostringstream mm;
[code].....
note : i tried displaying just szcurrentDate and szdate_time they show the date exactly the same. in string,char* or int formats.
This program is supposed to compare 2 strings and print out a 1 if the characters match and a 0 if they dont. It compiles but doesnt give me the correct output.
Code: #include <stdio.h> #include <string.h> void func(); int main () { func(); return 0;
I am trying to compare a string that i have entered with a set of strings that have already been stored in a file. I am using strcmp function but i am not getting the result.
Code: printf(" Enter string:"); scanf("%s",&m); ptr_file =fopen("abc.text","r");
I have been skimming and searching but dont know how to word the search just right to find what I need to know. I have written simple stuff with the support of tutorials like weight conversion or loops counting up to a set number. Nothing amazing. The other day I found out how to input and print a string rather than a single text character which i though was bad ass. I even got it to read multiple strings on a single line and found a way to read multiple lines. I can even format it to read both integers and characters on the same line as long as I know the predefined format.
On to my question... How do I read multiple lines with both carecters and integers. for instance:
nissan 1996 toyota 1998 or more comples like nissan gtr 1996 toyota markii 1998
I want to use int year; char make[10]; maybe need to use char make[10][10]; for an array i would guess. char model[10]; optional for the extra data
but reproduce what i read in a different order. say... 1996 nissan 1998 toyota vice the original format.
this is what I have tried.
Code: scanf("%s %s", &make,&year);
//The way I seen to read multiple lines was on here
scanf("%[^/t]", %make);
But this wont let me separate the two into two differnet definded data types. Let alone use printf to display them in reverse order.
I am starting a new thread. So I try to sort an array with qsort and then save the new order, so this means if I have a list like:
4 3 7 2 [0] [1] [2] [3], after sorting it becomes: 2 3 4 7 [3] [1] [0] [2] <== this is what I want to have!
Which works fine, with following code:
void qsort_my(int *a, int l, int r, int *array_order) { int j; if( l < r ) { j = split( a, l, r, array_order); qsort_my( a, l, j-1, array_order); qsort_my( a, j+1, r, array_order);
before calling switch_pos, but it is not working since sometimes you swap two numbers like:
11 9 15 9 <= here the 11 and 15 are swapped, but the two 9's will never be swapped <=> compared.I mean I could run it again with the array_order on the first parameter position, but this would increase my runtime enormously!
I am tying to compare two histograms, but it gives error. Here I have given my code, histogram file and error message. Histogram file 3*5 matrix(output_test.txt):
1 2 3 4 5 5 2 1 4 2 2 1 2 4 2
code:
Code: int main(..........) { ................................................ Mat first_histogram(1,feature_vector_size, CV_32F); Mat second_histogram(1,feature_vector_size, CV_32F);
I can access a physical device to read a specific sector in a USB hard drive. But my question is how can I Write to a specific sector? Lets say I want to replace what is in a specific sector of a hard drive with a new data.
I am trying to print a specific line from a textfile
e.g I have a text file called info.txt and inside it contains the id,item name, price, quantity
Code: 1,shirt,100,10 2,pants,50,9 3,pen,20,8
I know how to find a specific word at the line in the file but how do I find and print out the specific line e.g(print out just the entire contents of line 2)?
Code: string temDescription; ofstream fout; int curLine = 0;
I am suppose to make a program that will output a line for a specific age group,but everytime I execute the exe file it gives me the desired line and also the last line included everytime.Where did I go wrong with it including the last line everytime?
#include <iostream> using namespace std; int main() { double age; cout<<"Enter your age:"; cin>>age; if (0<age && age <6)
How can I create in my C++ program so a user can paste a text and then choose a character on specific line and place?. The above thing isn't that important. I just want to place a character on a specific line and place.
I mean something like this:
Enter a character:
You choosed " / "
On which line do want the character?
You choosed "Line 1 and 2"
Where do you want the the to appear on the line? (left or right)
I have a button that calls a delete stored procedure with only two parameters. I can run the stored procedure via SQL manager and know it works. But, when I call the stored procedure from a sqldatasource on the .aspx page I get this error: Procedure or function has too many arguments specified.
I have a certain piece of code that I want to run every 2 minutes. One of my ideas is to get the time and modules that with whatever number represents 2 minutes. Would this work?
I hope that this isn't an elementary question to you more experienced people, but I am having some trouble with my .DLL file. I haven't ever had a problem with compiling and linking it with my main project before, but it appears now some sort of problem has started. The message that appears is :
I have no qualms with posting my .DLL source, as it is not particularly long or complex. It seems the problem functions are the last two I've added ( load_sound( ) and play_sound( ) ).
Here is what I'm linking it with :
Code:
-------------- Build: Debug in game (compiler: GNU GCC Compiler)--------------- mingw32-g++.exe -shared -Wl,--output-def=binDebuglibgame.def -Wl,--out-implib=binDebuglibgame.a -Wl,--dll -L"F:FBLARandom gamegame.dll.sourcegame" objDebugconversion.o objDebugprojectile.o objDebugSDL_utility_functions.o objDebug ime.o -o binDebuglibgame.dll -lSDL -lSDL_mixer Creating library file: binDebuglibgame.a
Output size is 49.10 KB Process terminated with status 0 (0 minutes, 0 seconds) 0 errors, 0 warnings (0 minutes, 0 seconds) projectile.c :