I have a function that converts an integer to Roman numeral and i've been searching everywhere trying to find out how to convert an uppercase string to lower case but I haven't found a good answer anywhere.
The problem I am facing is that I have to output the C++ input file and display every line of code in the output, except in the output I have to convert every if, else, and while as IF, ELSE, WHILE. I tackled the first part and now its onto the 'easier' part even t
write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use a character array to store the string.) Does this follow the criteria? This program is very similar to one I found on these forums but I have one problem, it outputs everything backwards! EX: dogs will output to SGOD. What I need to do to make it output correctly, I think it may have to do with getline?
#include <iostream> #include <cctype> #include <cstring> using namespace std; int main() { char let[100]; cout << "Enter what you would like to be UPPERCASE: ";
I am having trouble in creating a program (named "up.c") that should do the following:
- if you run the command ("up") with no arguments, it should read input from stdin and display it on stdout, converting lowercase letters to uppercase.
- if you run the command with one or more files (as arguments to the "up" command), your program should read input from each file and display it on stdout, again converting lowercase letters to uppercase.
I'm trying to create a single program that can do both of these, and handle errors gracefully. I've found that some codes work to convert the letters, but they seem overly simple and aren't giving me what I'm looking for in my program.
Have a program prompt the user for a filename to open. Change every alphabetic character in the file to a capital letter. Numbers and special characters should not be changed. Print the output to the screen.
My problem currently is I can't get it to open a file in the same directory as the programs .exe file. I get else statements error message each time.
okay so this program is basically getting the files from user input then reading the original file and convert the string into a uppercase/lowercase form and save it into another file. Is there a way to save the string from the first file to a variable then convertin the string in the variable and copy that onto the new file? So far i have
Code:
#include <stdio.h> #include <string.h> int main() {
I have to read multiple text files and change all uppercase to lowercase. i also put in a little extra with finding values and spaces and punctuation. But nothing comes out so i don't know if the file is even being read or maybe I'm reading it but not accessing the right way.
so the Standard Template Library isn't portableANSI? I'm studing C++ using the Teach Your Self C++ in 1 Hour a Day. but seems these code isn't correct for GNU compiler:
Code: #include <string> #include <iostream> #include <algorithm> int main () { using namespace std; cout << "Please enter a string for case-convertion:" << endl;
[Code] ....
i get several errors: "C:UsersJoaquimDocumentsCodeBlocks estmain.cpp|16|error: no matching function for call to 'transform(std::basic_string<char>::iterator, std::basic_string<char>::iterator, std::basic_string<char>::iterator, <unresolved overloaded function type>)'|"
I am trying to write a program that determines if a string has all unique lowercase letters. However i am unable to understand how to write the code as i am very new to C++ and my professor has given us some tasks to do and has not taught us any C++. i am familiar with the syntax but am not able to understand the tasks properly and able to complete them successfully
#include <iostream> #include <cctype> using namespace std;
I have a problem. I need to print the string called "last" in uppercase format. can you check why my program prints nothing.
Here is the important section of the code.
if (infile.is_open()) // if file was able to open { string line; while (getline(infile, line)) { string::size_type pos1 = line.find(' '); //pos1 is the position of the first space
I am new to coding Here is the problem. Have a program prompt the user for a filename to open. Change every alphabetic character in the file to a capital letter. Numbers and special characters should not be changed. Print the output to the screen.
Here is my code so far but i am only returning the last line of text capitalized from the file. I am trying to get the program to display all of the three lines of text from the file capitalized. The program displays the file correctly before i try and convert everything toupper();
Code:
Code: #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <ctype.h> int main() { char line[81], filename[21]; int i; FILE *inFile;
I need to write a C function that generates a random character array (i.e. string) of uppercase letters - getchar and putchar are the only IO functions that I can use. Below is what I have already - I am iterating for as many times as I am required to, and am modulating rand() by 25, (total letters in the alphabet). I'm trying to see how to get the random letter from the % 25, and also how to do this without toupper() [not sure if I can use that function].
void getRandomStr()){ char str[40]; for (int i = 0; i < 40; i++){ char c = rand() % 25); str[i] = toupper(c); }}
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.
I am writing a program when the beginning it you have to pick which step to preform out of a few steps. Once you choose the step. The user is asked to input what is asked and it should preform it. I have completed most of my steps but the one step giving me a hard time is converting a user inputed sentence into all lowercase letters, and then count the words of it. My program starts out like this if you pick this step Code: else
if (choice == 3) { /* Gather user's input */ printf(" You have chosen to convert a sentence to all lowercase letters and count the words " "Enter the sentence: "); gets ( sentence );
Call the function to convert the whole sentence to lowercase and count the number of words */
lowercase_string ( &sentence); countSentence ( &sentence); } /* End if statement */
this is the easy part in which I presume I did correctly, but now this is where I am getting the problems:
/* Prompts user to enter a sentence and convert it to lowercase and count the number of words */
I want to output the original sentence, then the sentence with all lower case letters, then at last output the number of words in the sentence. I declared all my variables up top, and I am wondering where my mistake is. When trying to compile it, I only get syntax errors which I don't understand.
Just wrote this extremely simple program but it seems to be malfunctioning. It counts correctly the number of uppercase letters in a string so long as i don't use the space-bar. once I add a space it only counts the number of uppercase letters of the first word..
printf("I ..........ing love programming");
Code:
#include <stdio.h> main() { char text[200]; int i = 0; int uppercase = 0; printf("Enter text:"); scanf("%s", text);
What I am trying to do is read a sequence of words from cin and store the values on a vector. Then process the vector and change each word to uppercase.
I know line 21 is the problem. I think I don't have the right syntax. That syntax works on string. I'm trying to adapt and use it on vector but it doesn't work.
#include <iostream> #include <string> #include <vector> int main()