main.c 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. #include <stdio.h>
  2. #include <string.h>
  3. void print(char* string);
  4. int main() {
  5. printf("--------------------------------------------------------------\n");
  6. printf("\n");
  7. printf(" ASCII Art Text Printer\n");
  8. printf("\n");
  9. printf("--------------------------------------------------------------\n");
  10. printf("\n");
  11. printf("This program takes a string of text as input from the user and\n");
  12. printf("outputs that text as ASCII art to the terminal.\n");
  13. printf("\n");
  14. printf("Enter the string to convert: ");
  15. char text[256];
  16. fgets(text, sizeof(text), stdin);
  17. int i = 0;
  18. char ptr;
  19. while(text[i]) {
  20. ptr = text[i];
  21. text[i] = (toupper(ptr));
  22. ++i;
  23. }
  24. print(text);
  25. return(0);
  26. }
  27. void print(char* string) {
  28. int len = strlen(string);
  29. int ind, ctr;
  30. char ptr;
  31. for(ind = 0; ind < 7; ++ind) {
  32. for(ctr = 0; ctr < len; ++ctr) {
  33. ptr = string[ctr];
  34. switch(ptr) {
  35. case 'A':
  36. switch(ind) {
  37. case 0:
  38. printf(" _____ ");
  39. break;
  40. case 1:
  41. printf("/ _ \\ ");
  42. break;
  43. case 2:
  44. printf("| |_| | ");
  45. break;
  46. case 3:
  47. printf("| _ | ");
  48. break;
  49. case 4:
  50. printf("| | | | ");
  51. break;
  52. case 5:
  53. printf("|_| |_| ");
  54. break;
  55. case 6:
  56. printf(" ");
  57. break;
  58. default:
  59. break;
  60. }
  61. break;
  62. case 'B':
  63. switch(ind) {
  64. case 0:
  65. printf(" _____ ");
  66. break;
  67. case 1:
  68. printf("| _ \\ ");
  69. break;
  70. case 2:
  71. printf("| |_| | ");
  72. break;
  73. case 3:
  74. printf("| _ < ");
  75. break;
  76. case 4:
  77. printf("| |_| | ");
  78. break;
  79. case 5:
  80. printf("|_____/ ");
  81. break;
  82. case 6:
  83. printf(" ");
  84. break;
  85. default:
  86. break;
  87. }
  88. break;
  89. case 'C':
  90. switch(ind) {
  91. case 0:
  92. printf(" _____ ");
  93. break;
  94. case 1:
  95. printf("/ _ \\ ");
  96. break;
  97. case 2:
  98. printf("| | |_| ");
  99. break;
  100. case 3:
  101. printf("| | _ ");
  102. break;
  103. case 4:
  104. printf("| |_| | ");
  105. break;
  106. case 5:
  107. printf("\\_____/ ");
  108. break;
  109. case 6:
  110. printf(" ");
  111. break;
  112. default:
  113. break;
  114. }
  115. break;
  116. case 'D':
  117. switch(ind) {
  118. case 0:
  119. printf(" _____ ");
  120. break;
  121. case 1:
  122. printf("| _ \\ ");
  123. break;
  124. case 2:
  125. printf("| | | | ");
  126. break;
  127. case 3:
  128. printf("| | | | ");
  129. break;
  130. case 4:
  131. printf("| |_| | ");
  132. break;
  133. case 5:
  134. printf("|_____/ ");
  135. break;
  136. case 6:
  137. printf(" ");
  138. break;
  139. default:
  140. break;
  141. }
  142. break;
  143. case 'E':
  144. switch(ind) {
  145. case 0:
  146. printf(" _____ ");
  147. break;
  148. case 1:
  149. printf("| ___| ");
  150. break;
  151. case 2:
  152. printf("| |_ ");
  153. break;
  154. case 3:
  155. printf("| _| ");
  156. break;
  157. case 4:
  158. printf("| |___ ");
  159. break;
  160. case 5:
  161. printf("|_____| ");
  162. break;
  163. case 6:
  164. printf(" ");
  165. break;
  166. default:
  167. break;
  168. }
  169. break;
  170. case 'F':
  171. switch(ind) {
  172. case 0:
  173. printf(" _____ ");
  174. break;
  175. case 1:
  176. printf("| ___| ");
  177. break;
  178. case 2:
  179. printf("| |_ ");
  180. break;
  181. case 3:
  182. printf("| _| ");
  183. break;
  184. case 4:
  185. printf("| | ");
  186. break;
  187. case 5:
  188. printf("|_| ");
  189. break;
  190. case 6:
  191. printf(" ");
  192. break;
  193. default:
  194. break;
  195. }
  196. break;
  197. case 'G':
  198. switch(ind) {
  199. case 0:
  200. printf(" _____ ");
  201. break;
  202. case 1:
  203. printf("/ _ \\ ");
  204. break;
  205. case 2:
  206. printf("| | |_| ");
  207. break;
  208. case 3:
  209. printf("| | __ ");
  210. break;
  211. case 4:
  212. printf("| |_\\ \\ ");
  213. break;
  214. case 5:
  215. printf("\\___|_| ");
  216. break;
  217. case 6:
  218. printf(" ");
  219. break;
  220. default:
  221. break;
  222. }
  223. break;
  224. case 'H':
  225. switch(ind) {
  226. case 0:
  227. printf(" _ _ ");
  228. break;
  229. case 1:
  230. printf("| | | | ");
  231. break;
  232. case 2:
  233. printf("| |_| | ");
  234. break;
  235. case 3:
  236. printf("| _ | ");
  237. break;
  238. case 4:
  239. printf("| | | | ");
  240. break;
  241. case 5:
  242. printf("|_| |_| ");
  243. break;
  244. case 6:
  245. printf(" ");
  246. break;
  247. default:
  248. break;
  249. }
  250. break;
  251. case 'I':
  252. switch(ind) {
  253. case 0:
  254. printf(" _____ ");
  255. break;
  256. case 1:
  257. printf("|_ _| ");
  258. break;
  259. case 2:
  260. printf(" | | ");
  261. break;
  262. case 3:
  263. printf(" | | ");
  264. break;
  265. case 4:
  266. printf(" _| |_ ");
  267. break;
  268. case 5:
  269. printf("|_____| ");
  270. break;
  271. case 6:
  272. printf(" ");
  273. break;
  274. default:
  275. break;
  276. }
  277. break;
  278. case 'J':
  279. switch(ind) {
  280. case 0:
  281. printf(" _____ ");
  282. break;
  283. case 1:
  284. printf("|_ _| ");
  285. break;
  286. case 2:
  287. printf(" | | ");
  288. break;
  289. case 3:
  290. printf(" | | ");
  291. break;
  292. case 4:
  293. printf("|\\| | ");
  294. break;
  295. case 5:
  296. printf(" \\__| ");
  297. break;
  298. case 6:
  299. printf(" ");
  300. break;
  301. default:
  302. break;
  303. }
  304. break;
  305. case 'K':
  306. switch(ind) {
  307. case 0:
  308. printf(" _ _ ");
  309. break;
  310. case 1:
  311. printf("| | | | ");
  312. break;
  313. case 2:
  314. printf("| |/ / ");
  315. break;
  316. case 3:
  317. printf("| < ");
  318. break;
  319. case 4:
  320. printf("| |\\ \\ ");
  321. break;
  322. case 5:
  323. printf("|_| |_| ");
  324. break;
  325. case 6:
  326. printf(" ");
  327. break;
  328. default:
  329. break;
  330. }
  331. break;
  332. case 'L':
  333. switch(ind) {
  334. case 0:
  335. printf(" _ ");
  336. break;
  337. case 1:
  338. printf("| | ");
  339. break;
  340. case 2:
  341. printf("| | ");
  342. break;
  343. case 3:
  344. printf("| | ");
  345. break;
  346. case 4:
  347. printf("| |___ ");
  348. break;
  349. case 5:
  350. printf("|_____| ");
  351. break;
  352. case 6:
  353. printf(" ");
  354. break;
  355. default:
  356. break;
  357. }
  358. break;
  359. case 'M':
  360. switch(ind) {
  361. case 0:
  362. printf(" _ _ ");
  363. break;
  364. case 1:
  365. printf("| | | | ");
  366. break;
  367. case 2:
  368. printf("| v | ");
  369. break;
  370. case 3:
  371. printf("| \\_/ | ");
  372. break;
  373. case 4:
  374. printf("| | | | ");
  375. break;
  376. case 5:
  377. printf("|_| |_| ");
  378. break;
  379. case 6:
  380. printf(" ");
  381. break;
  382. default:
  383. break;
  384. }
  385. break;
  386. case 'N':
  387. switch(ind) {
  388. case 0:
  389. printf(" _ _ ");
  390. break;
  391. case 1:
  392. printf("| \\ | | ");
  393. break;
  394. case 2:
  395. printf("| \\| | ");
  396. break;
  397. case 3:
  398. printf("| \\ | ");
  399. break;
  400. case 4:
  401. printf("| |\\ | ");
  402. break;
  403. case 5:
  404. printf("|_| |_| ");
  405. break;
  406. case 6:
  407. printf(" ");
  408. break;
  409. default:
  410. break;
  411. }
  412. break;
  413. case 'O':
  414. switch(ind) {
  415. case 0:
  416. printf(" _____ ");
  417. break;
  418. case 1:
  419. printf("/ _ \\ ");
  420. break;
  421. case 2:
  422. printf("| | | | ");
  423. break;
  424. case 3:
  425. printf("| | | | ");
  426. break;
  427. case 4:
  428. printf("| |_| | ");
  429. break;
  430. case 5:
  431. printf("\\_____/ ");
  432. break;
  433. case 6:
  434. printf(" ");
  435. break;
  436. default:
  437. break;
  438. }
  439. break;
  440. case 'P':
  441. switch(ind) {
  442. case 0:
  443. printf(" _____ ");
  444. break;
  445. case 1:
  446. printf("| _ \\ ");
  447. break;
  448. case 2:
  449. printf("| |_| | ");
  450. break;
  451. case 3:
  452. printf("| ___/ ");
  453. break;
  454. case 4:
  455. printf("| | ");
  456. break;
  457. case 5:
  458. printf("|_| ");
  459. break;
  460. case 6:
  461. printf(" ");
  462. break;
  463. default:
  464. break;
  465. }
  466. break;
  467. case 'Q':
  468. switch(ind) {
  469. case 0:
  470. printf(" _____ ");
  471. break;
  472. case 1:
  473. printf("/ _ \\ ");
  474. break;
  475. case 2:
  476. printf("| | | | ");
  477. break;
  478. case 3:
  479. printf("| | | | ");
  480. break;
  481. case 4:
  482. printf("| |_| | ");
  483. break;
  484. case 5:
  485. printf("\\___\\_\\ ");
  486. break;
  487. case 6:
  488. printf(" ");
  489. break;
  490. default:
  491. break;
  492. }
  493. break;
  494. case 'R':
  495. switch(ind) {
  496. case 0:
  497. printf(" _____ ");
  498. break;
  499. case 1:
  500. printf("| _ \\ ");
  501. break;
  502. case 2:
  503. printf("| |_| | ");
  504. break;
  505. case 3:
  506. printf("| _ < ");
  507. break;
  508. case 4:
  509. printf("| | \\ \\ ");
  510. break;
  511. case 5:
  512. printf("|_| |_| ");
  513. break;
  514. case 6:
  515. printf(" ");
  516. break;
  517. default:
  518. break;
  519. }
  520. break;
  521. case 'S':
  522. switch(ind) {
  523. case 0:
  524. printf(" _____ ");
  525. break;
  526. case 1:
  527. printf("| ___| ");
  528. break;
  529. case 2:
  530. printf("| |___ ");
  531. break;
  532. case 3:
  533. printf("|___ | ");
  534. break;
  535. case 4:
  536. printf(" ___| | ");
  537. break;
  538. case 5:
  539. printf("|_____| ");
  540. break;
  541. case 6:
  542. printf(" ");
  543. break;
  544. default:
  545. break;
  546. }
  547. break;
  548. case 'T':
  549. switch(ind) {
  550. case 0:
  551. printf(" _____ ");
  552. break;
  553. case 1:
  554. printf("|_ _| ");
  555. break;
  556. case 2:
  557. printf(" | | ");
  558. break;
  559. case 3:
  560. printf(" | | ");
  561. break;
  562. case 4:
  563. printf(" | | ");
  564. break;
  565. case 5:
  566. printf(" |_| ");
  567. break;
  568. case 6:
  569. printf(" ");
  570. break;
  571. default:
  572. break;
  573. }
  574. break;
  575. case 'U':
  576. switch(ind) {
  577. case 0:
  578. printf(" _ _ ");
  579. break;
  580. case 1:
  581. printf("| | | | ");
  582. break;
  583. case 2:
  584. printf("| | | | ");
  585. break;
  586. case 3:
  587. printf("| | | | ");
  588. break;
  589. case 4:
  590. printf("| |_| | ");
  591. break;
  592. case 5:
  593. printf(" \\__|_| ");
  594. break;
  595. case 6:
  596. printf(" ");
  597. break;
  598. default:
  599. break;
  600. }
  601. break;
  602. case 'V':
  603. switch(ind) {
  604. case 0:
  605. printf(" _ _ ");
  606. break;
  607. case 1:
  608. printf("| | | | ");
  609. break;
  610. case 2:
  611. printf("| | | | ");
  612. break;
  613. case 3:
  614. printf("| | | | ");
  615. break;
  616. case 4:
  617. printf("| |_| | ");
  618. break;
  619. case 5:
  620. printf(" \\___/ ");
  621. break;
  622. case 6:
  623. printf(" ");
  624. break;
  625. default:
  626. break;
  627. }
  628. break;
  629. case 'W':
  630. switch(ind) {
  631. case 0:
  632. printf(" _ _ ");
  633. break;
  634. case 1:
  635. printf("| | | | ");
  636. break;
  637. case 2:
  638. printf("| |_| | ");
  639. break;
  640. case 3:
  641. printf("| / \\ | ");
  642. break;
  643. case 4:
  644. printf("| ^ | ");
  645. break;
  646. case 5:
  647. printf("|_| |_| ");
  648. break;
  649. case 6:
  650. printf(" ");
  651. break;
  652. default:
  653. break;
  654. }
  655. break;
  656. case 'X':
  657. switch(ind) {
  658. case 0:
  659. printf(" _ _ ");
  660. break;
  661. case 1:
  662. printf("| | | | ");
  663. break;
  664. case 2:
  665. printf(" \\ v / ");
  666. break;
  667. case 3:
  668. printf(" | | ");
  669. break;
  670. case 4:
  671. printf(" / ^ \\ ");
  672. break;
  673. case 5:
  674. printf("|_| |_| ");
  675. break;
  676. case 6:
  677. printf(" ");
  678. break;
  679. default:
  680. break;
  681. }
  682. break;
  683. case 'Y':
  684. switch(ind) {
  685. case 0:
  686. printf(" _ _ ");
  687. break;
  688. case 1:
  689. printf("| \\ / | ");
  690. break;
  691. case 2:
  692. printf(" \\ v / ");
  693. break;
  694. case 3:
  695. printf(" | | ");
  696. break;
  697. case 4:
  698. printf(" | | ");
  699. break;
  700. case 5:
  701. printf(" |_| ");
  702. break;
  703. case 6:
  704. printf(" ");
  705. break;
  706. default:
  707. break;
  708. }
  709. break;
  710. case 'Z':
  711. switch(ind) {
  712. case 0:
  713. printf(" _____ ");
  714. break;
  715. case 1:
  716. printf("|___ | ");
  717. break;
  718. case 2:
  719. printf(" / / ");
  720. break;
  721. case 3:
  722. printf(" / / ");
  723. break;
  724. case 4:
  725. printf(" / /__ ");
  726. break;
  727. case 5:
  728. printf("|_____| ");
  729. break;
  730. case 6:
  731. printf(" ");
  732. break;
  733. default:
  734. break;
  735. }
  736. break;
  737. case ' ':
  738. printf(" ");
  739. break;
  740. case ',':
  741. switch(ind) {
  742. case 0:
  743. printf(" ");
  744. break;
  745. case 1:
  746. printf(" ");
  747. break;
  748. case 2:
  749. printf(" ");
  750. break;
  751. case 3:
  752. printf(" ");
  753. break;
  754. case 4:
  755. printf(" __ ");
  756. break;
  757. case 5:
  758. printf(" | | ");
  759. break;
  760. case 6:
  761. printf(" |/ ");
  762. break;
  763. }
  764. default:
  765. break;
  766. }
  767. }
  768. printf("\n");
  769. }
  770. printf("\n");
  771. }