1
0
This repository has been archived on 2024-11-25. You can view files and clone it, but cannot push or open issues or pull requests.
CPP_Module_00/ex00/megaphone.cpp

44 lines
1.3 KiB
C++
Raw Normal View History

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* megaphone.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/25 16:31:50 by adjoly #+# #+# */
/* Updated: 2024/10/25 23:25:48 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include <cctype>
#include <iostream>
#include <string>
void str_to_upper(std::string &str)
{
char *ptr = (char *)str.c_str();
while (*ptr)
{
*ptr = std::toupper(*ptr);
ptr++;
}
}
int main(int ac, char **av)
{
std::string str;
(void)av;
if (ac < 2)
std::cout << "* LOUD AND UNBEARABLE FEEDBACK NOISE *" << std::endl;
else
{
while (++av && *av)
str.append(*av);
str_to_upper(str);
std::cout << str << std::endl;
}
return (0);
}