I know how to find find ASCII value of given character, but I am not getting how to find ASCII value of given string. For example I want to find ASCII value of string "HELLO",so how to do that.
My program is find non printable ASCII value(1 to 32) and calculate count from a text like "hi<tab>this<space>my text.i'm using library file here.(visual studio 2012)
removeascii.h(program name) #pragma once #include<stdint.h> #include <string> using std::string; namespace ascii
[Code] ....
My ERROR is:
1>c:program files (x86)microsoft visual studio 11.0vcunittestincludecppunittestassert.h(65): error C2338: Test writer must define specialization of ToString<const Q& q> for your class class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >
I need to make program which converts text (letters and digits only) into 7-digit ascii code. The start and end code is "1100011", so it must not appear inside the output code, thus a zero should be added in it (11000011).
Not that it matters much what my task is - I have a problem. Here's the code:
Code: #include <iostream> #include <stdlib.h> using namespace std; int main() { string in,out="",pk="1100011"; getline(cin,in);
[Code] ....
The 'pk' string loses its value here when I enter a character in the input and I cant figure out why... I got that the problem is somewhere in the first if loop, since the code prints pk nicely when cout is before the loop (comment 1)..however, after the loop (comment 2) it prints nothing..... When compiled, it works nice when I input numbers, but 1 character - and 'pk' disappears...
So the program reads contents from a text file into a vector and then the user enters in a string that they want to search for. The program iterates through the vector to find the string and then saves that line to another vector to display later(incase there is more then 1 instance of the string found).
Here is what I have atm:
void doSearch(vector<string> &phonelist, string searcher, vector<string> &holdNumbers) { int i = 0; string value;
[Code].....
I just get an R6010 error -abort() has been called.
printf(" Enter a line of Morse Code for decrypting"); scanf("%s",phr); len=strlen(phr); for(a=0;a<36;a++) { if(strcmp(phr, morse[a])==0) printf("%c", alpha[a]); };printf(" ");
The output :
[output] Enter line to encrypt: ..... -.... --...
converting... 5 [/output]
It should read all code, including null. between coded letter one space, between coded word three spaces.
I am stuck in some logic and want to write a program to do following tasks : I have three string variables to be compared to each other,a string having sub string & hierarchy string!!
1.) name1=john name2=tom_john_tom name3=alextom_john thus we need to search john from name2 and name3 and if name1 exists in both name2 and name3 then ok else check for step2
2.) name1=a.b.c.d ,name2=a.b.c.d and name3=a.b.c.d we need to compare each string seperated by a dot in all three variables and we need to match each string seperated by a delimeter "." if name1.a==name2.a==name3.a and name1.b==name2.b==name3.b ,name1.c==name2.c==name3.c and name1.d==name2.d==name3.d then its a match else its a mismatch
Also,the catch is we can have name1 ,name2 and name3 in format name1=*.*.*.* and name2=*.*.*.* and name3=*.*.*.* where * defines it can be any value to be matched
I got a homework that require to count number of words in a text file and also display the first and last 10 words of the text file to the console. I have finished the counter problem and now I struggle showing the first and last 10 words.
#include <iostream> #include <sstream> #include <string> #include <fstream> using namespace std; int tokenize(string sentence, string tokenizedWords[]);
I'm trying to figure out the word frequency of a user inserted string. I've tried doing it via getline of the struct array and via the getline of the string word but neither either the former crashes or the latter just prints out the whole string.
I have a question about finding the length of first sentence in an input string.
For example, let the input string be: dream in code. community learning
The length of first sentence is 13 (blanks are included). My question is how to create conditions for multiple punctuation signs (!,?)? If while loop goes like:
I need a code that will search through string 1 and find the first place with a letter that also appears in string 2 and return the pointer of that place. This is what I wrote:
char strPbrk(const char *s1, const char *s2) { char p = *s1; for (int i = 0; i < strlen(s1); i++) for (int j = 0; j < strlen(s2); j++) if ((p+i) == *(s2+j)) return p; return NULL; }
but it continues to return wrong values idk what I'm doing wrong.
and it wil output each word and maybe then can search for similar words if there would be 2 strings then i would use strstr but i dont know how to do with one string.
write a C program which repeatedly reads in sentences from the user and reports on how many capital letters are in the sentence and how many punctuation characters. Your program will stop asking for input once the user has entered in a blank line. Consider the following example usage with the program. User input is marked in underline:
Enter a sentence: John and Mary went to Fred's house. You used 3 capital letters and 2 punctuation characters. Enter a sentence: I like A&W more than McDonald's. You used 5 capital letters and 3 punctuation characters. Enter a sentence: Good bye!
Hint: make use of the standard C functions ispunct and isupper. Other requirements. You must make two functions.
Make a function called find_characters, which has a return type of void, and which has three parameters: one of type char * (a string to find characters in), one of type int * (a reference to int variable indicating how many capital letters are in the string) and the last one also of type int * (a reference to an int variable indicating how many punctuation characters are in the string). Your find_characters function should scan the string and update the two variables it has references to.Make a main function.
This function should repeatedly read in a string from the user, call your find_characters function, and output the information returned to it by the find_characters function indicating how many capital letters and how many punctuation characters were in the string. Your main function should stop reading in input when the user enters in a blank string (i.e., the user just hits enter without entering anything else in). You may assume that the user will not enter in a sentence longer than 100 characters