Question

In: Computer Science

PART A Write a C program that takes the names and surnames of the students and...

PART A

Write a C program that takes the names and surnames of the students and then displays the initial and last name of the name on the screen. For instance, if Onur Uslu is entered as input, the output of our program must be O. Uslu.

PART B

Write a C program that asks the user to enter a string and then sends it to a function that does the following job and shows the response from the function on the screen. The function must return all words in the string from the program by converting the initial letters into their large form.

Example Output

Type of a string:Hello world

New sentence:Hello World

Solutions

Expert Solution

PART A:

CODE:

#include <stdio.h>

int main() {
  
    int testcases;
    char name[100];
    char surname[100];
  
    printf("Enter total number of testcases :: ");
    scanf("%d",&testcases);
  
    while(testcases--) {
      
        printf("Enter SurName :: ");
        scanf("%s",surname);
      
        printf("Enter Name :: ");
        scanf("%s",name);
      
        printf("%c. %s\n",surname[0],name);
      
    }
  
    return 0;
}

OUTPUT SCREEN:

PART B:

CODE:

#include <stdio.h>

int main() {
  
    int testcases;
    char string[200];
  
    printf("Enter string :: ");
    scanf("%[^\n]s",string);
  
    int i;
  
    for(i = 0; string[i] != '\0'; i++) {
      
        if(i == 0 && string[i] >= 'a' && string[i] <= 'z') {
            string[i] = string[i] - 32;
        }
      
        if(string[i] == ' ' && string[i+1] >= 'a' && string[i+1] <= 'z') {
            i++;
            string[i] = string[i] - 32;
        }
    }
  
    printf("%s",string);
  
    return 0;
}

OUTPUT SCREENS:


Related Solutions

Write a program to demonstrate the use of InetAddress. The program takes a list of names...
Write a program to demonstrate the use of InetAddress. The program takes a list of names or IP addresses as command line parameters and prints the name and an IP address of the local host, followed by names and IP addresses of the hosts specified on the command line. use java program
C++ Description: You will write a program that reads students names followed by their final grade....
C++ Description: You will write a program that reads students names followed by their final grade. It will output the names and their grade, followed by the corresponding letter grade. It will also print the name of the students(s) with the highest grade Student data will be stored in a struct called studentType which has 4 members: fName lName score letterGrade Assume there are 20 students Your main() function will only have variable definitions and function calls You MUST have...
using c++. ALWAYS GRADE MY ANSWERS Write a program that reads students’ names followed by their...
using c++. ALWAYS GRADE MY ANSWERS Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type...
Write in C++ Write a program that accepts the names of three political parties and the...
Write in C++ Write a program that accepts the names of three political parties and the number of votes each received in the last mayoral election. Display the percentage of the vote each party received.   Be sure to provide labels (party name) and number-align your output values.
Write a program that reads students’ names followed by their test scores. The program should output...
Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed by the test scores and the relevant grade. It should also find and print the highest test score and the name of the students having the highest test score. Student data should be stored in a struct variable of type studentType, which has four components: studentFName and studentLName of type string, testScore of type int (testScore is between 0 and...
Write a program in C that takes the length and the integers to be stored in...
Write a program in C that takes the length and the integers to be stored in an array and shifts array by N positions. Example: Input the number of elements to store in the array (max 10) : 5 Input 5 integers to be stored : Index - 0 : 12 Index - 1 : 29 Index - 2 : 68 Index - 3 : 32 Index - 4 : 97 Input number of shifts : 2 Expected Output :...
C++ Vector Write a program that allows the user to enter the last names of the...
C++ Vector Write a program that allows the user to enter the last names of the candidates in a local election and the votes received by each candidate. The program should then output each candidate's name, votes received by that candidate, and the percentage of the total votes received by the candidate. Assume a user enters a candidate's name more than once and assume that two or more candidates receive the same number of votes. Your program should output the...
Using OOP, write a C++ program that will read in a file of names. The file...
Using OOP, write a C++ program that will read in a file of names. The file is called Names.txt and should be located in the current directory of your program. Read in and store the names into an array of 30 names. Sort the array using the selection sort or the bubblesort code found in your textbook. List the roster of students in ascending alphabetical order. Projects using global variables or not using a class and object will result in...
C++ Write a program that reads in a list of 10 names as input from a...
C++ Write a program that reads in a list of 10 names as input from a user and places them in an array. The program will prompt for a name and return the number of times that name was entered in the list. The program should output total number of instances of that name and then prompt for another name until the word done is typed in. For this lab, use the string data type as opposed to char to...
The program should be written in C++ with comments Write a program that takes graduation rates...
The program should be written in C++ with comments Write a program that takes graduation rates (per 1000 of the population) for North, South, East, West and Central United States. Input the number from each of the regions in a function returning an int with the graduation rate to the main program. Also figure out which region has the highest graduation rate in another function and display the result from inside that particular function. So your function prototypes should be...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT