I am writing a code that requires the user to input either B or b for bright or D or d for dim. Basically, B is bright and D is dim but I have to code the program such that it allows for both he capital letter and the lowercase letter to be recognized.
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
How can I write program that can convert an input string into a form that only the first letter of the string is a capital letter and the rest is lower-case?
I need to display 0-15 hex numbers[0X00-0x0F] in decimal value...& I'm getting the output but it's not exactly what it should be,below is my code.. [This not the complete code,but main part where the changes are done]
Actual output i should get is for 1v it should generate 0001,for 2v it should generate 0010 and simultaneously till [15v-1111]... But what i'm getting is exactly different to this for eg for 7v,8v&9v the bits generated are 1101,1011,1011 respectively...
I have to write a function that reads letters one at a time from a text file, such as (aBCdefG) using fgetc(). However, each character needs to be inserted into the array in ascending ASCII order, so it should come out as (BCGadef). I wanted to use an insertion sort, however, that would require me to pass the whole array. My professor wants me to sort the letters as they are read, though, and not as a whole array.Can you even do that?
I have to count the letters from a text file into an array so the first spot is the number of A's second spot number of B's and so on then take the array and sort it in decending order how could i do this without loosing track of where the numbers go so if there are more b's than a's they switch but how will i know where each letter has moved in the array after it has been sorted?
My objective is to create a file and save some text in it. But the twist is that file should be created in pdf format.
I have written following code:
Code: #include<stdio.h>
Code: int main() { FILE *fp; char ch; fp=fopen("file.pdf","w"); fprintf(fp, "%PDF-1.3"); //to initiate data storage in pdf file printf(" Enter data to be stored in to the file:"); while((ch=getchar())!=EOF) putc(ch,fp); fclose(fp); return 0;}
Now my file is created in pdf format, but when I open it by double click on it, it is not open and gives the message like: "Error in opening document. This file is damaged and could not be repaired."
I'm making a very first program. It's very little more then a simplistic calculator, but i'm having a problem with the cout function. It won't display any text what could the reasons be?
#include <iostream> #include <string> #include <sstream> using namespacestd; int main () { do { int(a);
[Code]...
Oh and i'm aware it's still riddled with numerous problems, I just have been working on the cout thing first.
But the output rows are not aligned as shown in the attached picture. There a two problems.
1. Data rows don't align with the header row. 2. When the first element of a row changes to two digits, the other elements are shifted.
According to MSDN [URL] ...., CString::Format() works the same way as printf(). I wrote a small program using printf() to do the same thing, and the output in the console are perfectly aligned.
I'm working on a program that can load all words from a dictionary "English2.txt" (it's attached to the post), then put every word into a 2-dimensional matrix (every line is reserved for one word) and display them. After loading every word into a matrix, when I try to display first 8 words with printf, I can't do it without '' at the end of a line. Otherwise only the 8th word is displayed... What's more, when I try to read the length of the first word with strlen, it says, that it has 4 characters (in fact there are only 3 and it's the word "AAA"). What could be the reason for that?
That's what I have but it doesn't like the fprintf function because BigEndianChecksum is an unsigned int and it wants a pointer to a const char. Is there a function similar to this that will display an 8 digit integer in a txt outfile?
i have turbo c++ 3.0 installed . my program is compiled without error and is running. but when i choose option to display scores in the consol , it hangs . check my code. i have to run this on same compiler. i just want to display all the contenets of text file .
Is it possible to display data from a textfile and also save data in to a textfile, reason being is for me to create back-ups of data into a textfile hidden somewhere in a safe location in the local disk or server in case of database error and failure.
I have been given an assignment to make a code to read some text nd display all the words nd the number of times they appear in another file or as output without displaying the repeating words. I made the code but its not giving any output.
I have almost a hundred names in a text file that I want to convert to email addresses and save to another file. I seem to have it working, but it doesn't print the full names in the email prefix. The output I'm looking for is Doe_John@livebrandm, but I'm only getting D_J@livebrandm. I'm not sure what I should specifically be reading up on that applies to this directly.
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.
Suppose my file a.txt has "ABC" written in it. Now I want to write a small b before capital B in the file. How will I do it. I've tried to do it but i'm having problems.
1. When opened in app mode seekp doesn't work. 2. When opened normally previous written data is erased.
And the following program that displays block by block:
StreamReader streamReader = new StreamReader("G:LAB123LABWORK2.txt"); int block = 0; while (!streamReader.EndOfStream) { string line = streamReader.ReadLine().Trim(); if (line.CompareTo("") == 0)
[Code] .....
My problem is am supposed to add a verification code so that if i put a string e.g 1:?:? it returns the block where the string is found and gives of all possible answers.
Write a program that inputs a string and then converts each 1st letter of a word in the string into capital case. An example run of the program is shown below:
Enter string: introduction to programming Output string: Introduction To Programming
I'm just trying to find out if the way I've setup my code currently allows me to count the letters as they occur? I don't yet see how to do it but I need clarification. Ideally the function letterCounter would do the counting but atm I'm just trying to figuring it out in the display function.
Code: #include<stdio.h> #include<string.h> #define a 9 #define b 9 #define c 3 int main() {
[Code] .....
In practice section there was a challenge to print up numbers in letters up to billion including negatives I didn't look at the solution and came up with this but it is getting difficult after this point....