This document provides instructions for writing a C program to count the vowels, consonants, digits, and whitespace in a string. It begins by explaining how to declare, initialize, read, and manipulate strings in C. It then presents the algorithm and full C program to iterate through a string, check each character, and increment the appropriate counter. The program takes a string as input and outputs the count of each type of character. Examples of additional string programs are provided for practice.
It is an attempt to make the students of IT understand the basics of programming in C in a simple and easy way. Send your feedback for rectification/further development.
Programming is an essential skill if you seek a career in software development, or in other fields of Coding. This fundamental of programming course is the first in the specialization for Introduction to Programming in C, but its lessons extend to any language you might want to study. This is because programming is primarily about solving a set of problems and writing the algorithm.
It is an attempt to make the students of IT understand the basics of programming in C in a simple and easy way. Send your feedback for rectification/further development.
Programming is an essential skill if you seek a career in software development, or in other fields of Coding. This fundamental of programming course is the first in the specialization for Introduction to Programming in C, but its lessons extend to any language you might want to study. This is because programming is primarily about solving a set of problems and writing the algorithm.
At the end of this lecture students should be able to;
Define the declaration C strings.
Compare fixed length and variable length string.
Apply strings for functions.
Define string handling functions.
Apply taught concepts for writing programs.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSEDuvanRamosGarzon1
AIRCRAFT GENERAL
The Single Aisle is the most advanced family aircraft in service today, with fly-by-wire flight controls.
The A318, A319, A320 and A321 are twin-engine subsonic medium range aircraft.
The family offers a choice of engines
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
Event Management System Vb Net Project Report.pdfKamal Acharya
In present era, the scopes of information technology growing with a very fast .We do not see any are untouched from this industry. The scope of information technology has become wider includes: Business and industry. Household Business, Communication, Education, Entertainment, Science, Medicine, Engineering, Distance Learning, Weather Forecasting. Carrier Searching and so on.
My project named “Event Management System” is software that store and maintained all events coordinated in college. It also helpful to print related reports. My project will help to record the events coordinated by faculties with their Name, Event subject, date & details in an efficient & effective ways.
In my system we have to make a system by which a user can record all events coordinated by a particular faculty. In our proposed system some more featured are added which differs it from the existing system such as security.
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
1. C-Programming
Walchand Institute of Technology (RC1131), Solapur Page 1
Handout#8
Assignment/Program Statement:
Write a C program using String – Find Number of Vowels, Consonants, Digits and
White Space Character
Learning Objectives:
Students will be able to
- declare and initialize and the string
- read and display the string
- write the program to manipulate the string
Theory:
In C programming, array of character are called strings. A string is
terminated by null character /0. For example:
"c string tutorial"
Here, "c string tutorial" is a string. When, compiler encounters strings, it
appends null character at the end of string.
Declaration of strings
Strings are declared in C in similar manner as arrays. Only difference is that,
strings are of char type.
char s[5];
Strings can also be declared using pointer.
char *p
Initialization of strings
In C, string can be initialized in different number of ways.
char c[]="abcd";
OR,
char c[5]="abcd";
OR,
2. C-Programming
Walchand Institute of Technology (RC1131), Solapur Page 2
char c[]={'a','b','c','d','0'};
OR;
char c[5]={'a','b','c','d','0'};
String can also be initialized using pointers
char *c="abcd";
Reading Strings from user
o Reading words from user.
char c[20];
scanf("%s",c);
String variable c can only take a word. It is beacause when white
space is encountered, the scanf() function terminates.
Write a C program to illustrate how to read string from terminal.
#include <stdio.h>
int main(){
char name[20];
printf("Enter name: ");
scanf("%s",name);
printf("Your name is %s.",name);
return 0;
}
Output
Enter name: Dennis Ritchie
Your name is Dennis.
Here, program will ignore Ritchie because, scanf() function takes
only string before the white space.
o Reading a line of text
C program to read line of text manually.
#include <stdio.h>
int main(){
3. C-Programming
Walchand Institute of Technology (RC1131), Solapur Page 3
char name[30],ch;
int i=0;
printf("Enter name: ");
while(ch!='n') // terminates if user hit enter
{
ch=getchar();
name[i]=ch;
i++;
}
name[i]='0'; // inserting null character at end
printf("Name: %s",name);
return 0;
}
This process to take string is tedious. There are predefined functions
gets() and puts in C language to read and display string respectively.
int main(){
char name[30];
printf("Enter name: ");
gets(name); //Function to read string from user.
printf("Name: ");
puts(name); //Function to display string.
return 0;
}
Both, the above program has same output below:
Output
Enter name: Tom Hanks
Name: Tom Hanks
C supports a wide range of functions that manipulate null-terminated strings
4. C-Programming
Walchand Institute of Technology (RC1131), Solapur Page 4
So.No. Function & Purpose
1 strcpy(s1, s2);
Copies string s2 into string s1.
2 strcat(s1, s2);
Concatenates string s2 onto the end of string s1.
3 strlen(s1);
Returns the length of string s1.
4 strcmp(s1, s2);
Returns 0 if s1 and s2 are the same; less than 0 if s1<s2; greater
than 0 if s1>s2.
5 strchr(s1, ch);
Returns a pointer to the first occurrence of character ch in string
s1.
6 strstr(s1, s2);
Returns a pointer to the first occurrence of string s2 in string s1.
gets() and puts()
Functions gets() and puts() are two string functions to take string input from
user and display string respectively as mentioned in previous chapter.
#include<stdio.h>
int main(){
char name[30];
printf("Enter name: ");
gets(name); //Function to read string from user.
printf("Name: ");
puts(name); //Function to display string.
return 0;
}
5. C-Programming
Walchand Institute of Technology (RC1131), Solapur Page 5
Though, gets() and puts() function handle string, both these functions are
defined in "stdio.h" header file
[Reference: http://www.tutorialspoint.com/cprogramming/c_strings.htm and
http://www.programiz.com/c-programming/string-handling-functions ]
7. C-Programming
Walchand Institute of Technology (RC1131), Solapur Page 7
Algorithm:
1. Start
2. v=c=d=s=0
3. read the line of string
4. if line[i]!=’0’
if (line[i]=='a' || line[i]=='e' || line[i]=='i' || line[i]=='o' || line[i]=='u' ||
line[i]=='A' || line[i]=='E' || line[i]=='I' || line[i]=='O' || line[i]=='U')
c++
go to step 4
elseif ((line[i]>='a'&& line[i]<='z') || (line[i]>='A'&& line[i]<='Z'))
v++
go to step 4
elseif(line[i]>='0'&&c<='9')
d++
go to step 4
elseif (line[i]==' ')
s++
go to step 4
else
go to step 5
5. Display Vowels, Consonants, Digits and White spaces
6. Stop
Program:
#include<stdio.h>
int main()
{
char line[150];
int i,v,c,ch,d,s,o;
v=c=d=s=0;
printf("Enter a line of string:n");
gets(line);
for(i=0;line[i]!='0';++i)
{
8. C-Programming
Walchand Institute of Technology (RC1131), Solapur Page 8
if(line[i]=='a' || line[i]=='e' || line[i]=='i' || line[i]=='o' || line[i]=='u' ||
line[i]=='A' || line[i]=='E' || line[i]=='I' || line[i]=='O' || line[i]=='U')
++v;
else if((line[i]>='a'&& line[i]<='z') || (line[i]>='A'&& line[i]<='Z'))
++c;
else if(line[i]>='0'&&c<='9')
++d;
else if (line[i]==' ')
++s;
}
printf("Vowels: %d",v);
printf("nConsonants: %d",c);
printf("nDigits: %d",d);
printf("nWhite spaces: %d",s);
return 0;
}
Input:
Enter a line of string:
This program is easy 2 understand
Output:
Vowels: 9
Consonants: 18
Digits: 1
White spaces: 5
Practice Problem Statement:
1. Write a C program to find the Length of a String.
2. Write a C program to Concatenate Two Strings.
3. Write a C program to Copy a String.
4. Write a C program to remove all characters in a String except alphabet.
9. C-Programming
Walchand Institute of Technology (RC1131), Solapur Page 9
Conclusion:
Thus a C program using string – Find Number of Vowels, Consonants, Digits and
White Space Character is implemented.
Learning Outcomes:
At the end of this assignment, students are able to
- declare and initialize and the string
- read and display the string
- write the program to manipulate the string