Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gürcan Güleç
/
iag0581
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
241e8b3c
authored
Nov 24, 2016
by
Gürcan Güleç
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Committing lab 8 files
parent
52135fee
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
0 deletions
labs/lab8/string1.c
labs/lab8/string2.c
labs/lab8/string1.c
0 → 100644
View file @
241e8b3c
#include <stdio.h>
#include <string.h>
int
main
()
{
char
word
[
20
];
printf
(
"Enter a word: "
);
scanf
(
"%s"
,
word
);
int
length
=
strlen
(
word
);
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
printf
(
"%c
\n
"
,
word
[
i
]);
}
return
0
;
}
labs/lab8/string2.c
0 → 100644
View file @
241e8b3c
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int
main
()
{
char
word1
[
20
];
char
word2
[
20
];
int
length1
,
length2
;
int
option
;
char
lower
;
char
upper
;
int
i
=
0
;
int
a
=
0
;
// enter the words
printf
(
"Enter first word: "
);
scanf
(
"%s"
,
word1
);
printf
(
"Enter second word: "
);
scanf
(
"%s"
,
word2
);
if
(
strcmp
(
word1
,
word2
)
==
0
)
{
printf
(
"Both words are equal!
\n
"
);
}
else
{
printf
(
"Both words are not equal!
\n
"
);
}
printf
(
"Lenght(1), Uppercase(2), Lowercase(3): "
);
scanf
(
"%d"
,
&
option
);
switch
(
option
)
{
case
1
:
length1
=
strlen
(
word1
);
length2
=
strlen
(
word2
);
printf
(
"First word's length: %d
\n
"
,
length1
);
printf
(
"Second word's length: %d
\n
"
,
length2
);
break
;
case
2
:
printf
(
"To Upper! >>> "
);
while
(
word1
[
i
])
{
upper
=
word1
[
i
];
putchar
(
toupper
(
upper
));
i
++
;
}
printf
(
"
\n
"
);
printf
(
"To Lower! >>> "
);
while
(
word2
[
a
])
{
upper
=
word2
[
a
];
putchar
(
toupper
(
upper
));
a
++
;
}
printf
(
"
\n
"
);
break
;
case
3
:
printf
(
"To lower! >>> "
);
while
(
word1
[
i
])
{
lower
=
word1
[
i
];
putchar
(
tolower
(
lower
));
i
++
;
}
printf
(
"
\n
"
);
printf
(
"To lower! >>> "
);
while
(
word2
[
a
])
{
lower
=
word2
[
a
];
putchar
(
tolower
(
lower
));
a
++
;
}
printf
(
"
\n
"
);
break
;
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment