I need to count how many times letter appears in a text. I know that for default letters from 'a' to 'z' and from 'A' to 'Z' there is an interval. But I need also Lithuanian letters, such as ž,č,ę. I wrote this method: (it accepts char code and checks whether that char is a letter)
As you can see, a lot of checking in switch statement. I use 256 for this reason to have the same effect as unsigned char. But maybe there is a way to shrink down this method, or use some library?
I have to accept the numerical grade and determine the letter grade that the user will receive. I have to use a grading table to determine the letter grade based on the numerical grade. The Letter Grade table is
I am trying to fill an array with blank spaces and instead i get the number 32 over and over, i think this is the ANSI code for that character. how do i get the character itself?
I am trying to print out the letter frequency of a vector that the user inputs and what number that letter is in the ASCII. I am supposed to say, for example: "w" which is ASCII 119 occurs 2 times. How to do this?
I am new to c++. I am writing a program that reads in a text file and gives a count of how many times each letter appeared in the file. I got it to read the text file and do the letter count. B
X = 102 Y = 126 Z = 165 etc...
THAT IS WORNG
The sample output should be E = 165 T = 126 A = 102 O = 93 etc...
I got it to sort from lowest to highest for the frequency, but cant seem to get the appropriate letter assigned to it.
How would I detect if any letter key is pressed. Would I have to use GetAsyncKeyState() for every letter key? Or could I have some kind of loop going through all the hexadecimal values for every letter? I don't know how I would go through hexadecimal values with a loop.
string eg("azertyFTW"); if(eg[one of the letters contained in this string] == 'c') { cout << "eg has the letter c in it"; } else { cout << "not this time :("; }
I wanna know why the program doesnt show "Invalid Letter Entered" when i enter any letter other than A S D or M
//Processing the data if (letter== 'A'||'S'||'M'||'D')// checking Add, subtract, multiply or divide { if (letter== 'A')//Adding the integers cout<<"Adding two integers = "<<first + second<<endl; else if (letter== 'S')//Subtracting the integers {
I am doing a homework assignment. I do not want the complete answer, just a hint. I have to load a file of names into an array, display the names, then sort the names alphabetically, display them again, then list how many names start with certain letters. I have everything done but how to display how many names start with a certain letter.
Here are the names:
Collins, Bill Smith, Bart Allen, Jim Griffin, Jim Stamey, Marty Rose, Geri ...........
I'm supposed to count the number of first capital letters in a string. I've written a code that counts every uppercase letter, and it turns out that this is not what the assignment is about. For example, the input "JAMES, How Are you?" should return an output of 3 (mine would return 7 in this case). Only J, H, A need to be counted.
In C how can I initialize a variable that is not a letter or number? For example with a number I can :
Code:
int i = 5; for ( i = 0; i <=5; i++ ); printf( "%d", i ) This would display a row of 5's
but what if I wanted to display a row of -----? What I am trying to do is read in a simple txt file, around the file I want ----1----2-----3 ect ect on the top ----a----b-----c down the side Then I want to be able to change the file at lets say position c2 and save it. This is the early stages of my attempt to set up a editable table.
I can get the first letter to change if there is only one word. But if there are two words it wont change and display the second word's first letter and I'm not sure why.
The assignment is to read a data file with a list of names, capitalize the first character of the first and last name by making an array and subtracting 32 from the character, and then outputting the names onto the screen. So far I have:
#include <iostream> #include <fstream> #include <string> using namespace std; int main () { string line; ifstream myfile ("Names.txt");
[Code] ....
this allows me to read a name, and capitalize the first letter of the first name. How to capitalize the first letter of the last name.
I have a difficulty with string methods for some reason. I tried solving a question from my book, which requires me to capitalize the first letter of every word in a string. I kept trying for maybe two hours yesterday, re-reading the string chapter to see if I'm forgetting a certain method or if something similar was discussed in the examples but I didn't find anything. I also googled it, and found a few answers, none of which I understood. They mostly had keywords or methods I wasn't familiar with. Anyway, here's where I am so far.
class Program { static string UpperCase(string s) { int place; string b, st1, st2,st3; char letter; for (int i = 0; i <= s.Length - 1; i++) { if (i == 0) {
[Code]....
The code compiles without any errors, but when I enter a string it capitalizes correctly for the first two words and then it starts capitalizing letters in the middle of the words.
Write a program which is used to calculate the GPA based on the grades for different courses input by user. User should be able to use this to enter grades for as many courses as he wants unless he wants to quit. (you may consider using some loop). Once user has completed entering of data, the program should be able to provide a feedback to the user about the GPA. A is equal to 4, B is equal to 3, C is equal to 2, D is equal to 1, rest are 0. Use minimum 5 course to demonstrate working of your code.
Here is an example (User input is in italic and bold):
I need to reverse a word . For instance "Hello" after reversing will be "olleh" . It reverse first and last letter but its not reversing the rest of them
char arr[]="Hello"; int first=0; int last=sizeof(arr-1); int mid=sizeof(arr)/2;
I've made an effort for three days to write this code. But, my brain has stopped now. I wrote code to find the status of the game (win, loss or tie). However, I can't determine the tie status of the game. Tie status is the problem
I'm working with arrays that might have NULL bytes in them and I'm wondering how to determine the length of the array or store it somewhere with the array (strlen() won't work because of the NULL, right?).
I've found advice like store the length of the array in the first byte of the array, but since sizeof(size_t) is 8 should I leave the first 8 bytes for the length?
Would it be better do define my own structure which would store the array and its length? What's the usual way these things are handled in practice?