C/C++ :: String Of Characters - Sorting Alphabets And Numbers
Apr 20, 2014
My program reads a string of characters. Prints all occurrences of letters and numbers, sorted in alphabetical and numerical order. Letters will be converted to uppercase.Other characters are filtered out, while number of white spaces are counted.
the problem is it crushes when i run the program
Here is my code
#include <iostream>
const int SIZE = 100;
using namespace std;
int main() {
char *pStr, str[SIZE] = "", newStr[SIZE] = "", ch;
int count = 0, i = 0, j;
[Code] .....
View 1 Replies
Apr 20, 2014
My program reads a string of characters. Prints all occurrences of letters and numbers, sorted in alphabetical and numerical order. Letters will be converted to uppercase.Other characters are filtered out, while number of white spaces are counted.
The problem is it crashes when i run the program. Here is my code
#include <iostream>
const int SIZE = 100;
using namespace std;
int main() {
char *pStr, str[SIZE] = "", newStr[SIZE] = "", ch;
int count = 0, i = 0, j;
[Code] .....
View 5 Replies
View Related
Jan 9, 2013
//Sorting Vowels, Consonants, Digits and Other Characters in a String in C++
#include <iostream>
#include <string>
using namespace std;
int main() {
int vow,con,d,s;
vow=con=d=s=0;
[Code] ....
View 2 Replies
View Related
Aug 22, 2014
I am unable to create an array which has to content elements(1E, 2E, 3E, 4E). I tried using char however I am unable to display as it only shows the letter E.
View 19 Replies
View Related
Sep 2, 2014
I have a upcoming C++ exam. I would like to write a program to convert INDIVIDUAL digits into words.
E.g 678 = six seven eight[/size][/b]
I have the following code:
//Program to print individual digits in words
#include<iostream>
using namespace std;
int main() {
int num;
cout << "Enter a number between 0 and 9999: ";
[Code] ....
View 7 Replies
View Related
Feb 28, 2014
how to recognize the occurrences of different alphabets in a string and print the occurrences of each alphabet in string..
View 1 Replies
View Related
Sep 20, 2014
I'm trying to create a program that counts the amount of alphabetical characters, numbers, blanks and total amount of characters in a string a user gets to enter. The user also quits the program manually by pressing CTRL + D (in linux terminal).
These are the results I get from the code so far by typing in "hello cplusplus 123 c++" CTRL + D.
The string had:
Alphabetical characters...: 0
Numbers...................: 0
Blanks....................: 3
Total amount of characters: 20
So I can't seem to find a way to count the amount of alphabetical characters and numeric characters.
Here's my code:
#include <iostream>
#include <string>
#include <iomanip>
#include <cctype>
#include <sstream>
using namespace std;
int main() {
string tecken;
[Code] ....
The reason why I declared cctype is that I think I should use the isalpha, isdigit and isblank functions but how I am supposed to do that.
View 1 Replies
View Related
Nov 7, 2013
I am looking for a way to sort a string just by the alpha characters, not by the ASCII table. Therefore
string sort(string name) {
sort(name.begin(), name.end());
return name;
}
will not work. And I am looking for the most simple way to go about it!
View 7 Replies
View Related
Mar 25, 2015
I'm trying to write a lot of sample code to practice but I can not figure out how to take a string and sort each character in order of their increasing ASCII codes. I'm getting stuck trying to separate each letter to determine it's ASCII code. I know I have to use an array somehow, So far, this is my code:
#include <stdio.h>
#include <stdlib.h>
#define _CRT_SECURE_NO_WARNINGS
[Code].....
View 4 Replies
View Related
Mar 20, 2014
so my question is i want to print characters,no string just an array of characters,i do this but it s not working,maybe i have to put the '' at the end?
Code:
int main() {
int i;
char ch[5];
for(i = 0; i < 5; i++) {
scanf("%c",&ch[i]);
[Code]...
View 6 Replies
View Related
Jul 6, 2014
Im supposed to find the common characters between two string characters, assuming that the user wont input duplicate letters like ddog. When I run my code I get an output of a question mark upside down. Here is my code with comments on what each part is supposed to do
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
char str1[20], str2[20],remp = '