Question

is there any way that I can capitalize argv, such as argv[1] = hello, and argv[2]...

is there any way that I can capitalize argv, such as argv[1] = hello, and argv[2] = world to argv[1] = HELLO, argv[2] = WORLD without using strlen or toupper or copy them into new arry?

Homework Answers

Answer #1
#include <stdio.h>

int main(int argc, char *argv[]) {
    if (argc > 1) {
        int i, j;
        for (i = 1; i < argc; ++i) {
            j = 0;
            while (argv[i][j]) {
                if (argv[i][j] >= 'a' && argv[i][j] <= 'z')
                    argv[i][j] -= 32;   // to change lowercase letter to uppercase letter subtract 32 from letter
                j++;
            }
            printf("%s\n", argv[i]);
        }
    }
    return 0;
}

// directly modified argv into uppercase (no libraries used)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The funciton my_strcpy(char dest, const char cource) is to copy "hello world" from source to dest....
The funciton my_strcpy(char dest, const char cource) is to copy "hello world" from source to dest. Do not use the library. The copy process will only stop at the last "\0". Make sure dest is large enough to any lenght of sentence inputted. The following is my code. The program copy the first letter of "hello world" which is "h", but the requirement is to copy the whole sentence "hello world". Thank you for your helps #include <iostream> using namespace...
In DrRacket, is there any way I can change (list 1 (list 2 (list 3 4...
In DrRacket, is there any way I can change (list 1 (list 2 (list 3 4 5) 6 )7) to (list 1 2 3 4 5 6 7)?
Hello. for one of my assignment, I need to create any program using the C language...
Hello. for one of my assignment, I need to create any program using the C language and that must contain the following: - Error Checking - Use of Functions - Menu system - Array Processing It can be about anything, nothing specified but must contain the features mentioned above Thank you
Write a program that prompts the user to input a string and outputs the string in...
Write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use dynamic arrays to store the string.) my code below: /* Your code from Chapter 8, exercise 5 is below. Rewrite the following code to using dynamic arrays. */ #include <iostream> #include <cstring> #include <cctype> using namespace std; int main() { //char str[81]; //creating memory for str array of size 80 using dynamic memory allocation char *str = new char[80]; int len;...
hello i do have Q about Management course (Human Resource Systems chapter) because i have a...
hello i do have Q about Management course (Human Resource Systems chapter) because i have a hard time to write , could any one help with this ?? here is the Q: You are the CEO and Founder of a new tech firm named Pilgrim. This firm has developed software that when traveling, automatically translates, maps your course, and purchases any transportation needs everyday while abroad. The software eliminates the need for translations as you speak into your microphone and...
Hello Everyone, I need to write a Python code for AES encryption and decryption for any...
Hello Everyone, I need to write a Python code for AES encryption and decryption for any text entered by the user. Can anyone please help me out with it? Thank you so much.
{where there is a will there's a way} this a qoute i just want an idea...
{where there is a will there's a way} this a qoute i just want an idea of font and design if you can able to do for me and i just copy thanks can use any font any size on illustrater or indesign
Hello, Kindly I need a short description and new facts can people learn about " options...
Hello, Kindly I need a short description and new facts can people learn about " options trading " . Thank you!!
Hello, I need your support to solve below question with more explanation if possible,, - Can...
Hello, I need your support to solve below question with more explanation if possible,, - Can large firms in Saudi Arabia also be entrepreneurial? Is it in their interests to be so? what pressures are there for them not to be entrepreneurial? Thanks,.,
hello, my question is, how can i use implicit differentiation to calculate the optimal surface area...
hello, my question is, how can i use implicit differentiation to calculate the optimal surface area of a box. Or any type of optimization problem involving the use of implicit differentiation. an example would be appreciated
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT