Advertisement
dberweger

Untitled

Feb 19th, 2021
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. string f1 = "a";
  7. string f2 = "b";
  8. string res = "";
  9.  
  10. for(int i = 0;i<10;i++){
  11. res = f1+f2;
  12. f1 = f2;
  13. f2 = res;
  14. cout << res << endl;
  15. }
  16. return 0;
  17. }
  18.  
  19.  
  20. #include <stdio.h>
  21. #include <iostream>
  22. #include <string.h>
  23.  
  24.  
  25. using namespace std;
  26.  
  27. int main()
  28. {
  29. char f1[100];
  30. char f2[100];
  31. char res[100];
  32. char suma[100];
  33.  
  34. strcpy(f1,"a");
  35. strcpy(f2,"b");
  36. strcpy(res,"");
  37.  
  38. strcat(res,f2);
  39.  
  40. cout << res;
  41.  
  42. /*
  43. for(int i = 0;i<10;i++){
  44. res = f1+f2;
  45. f1 = f2;
  46. f2 = res;
  47. cout << res << endl;
  48. }
  49. */
  50.  
  51. for(int i = 0;i<10;i++){
  52. strcpy
  53. }
  54. }
  55.  
  56. /*
  57. int main ()
  58. {
  59. char str1[]="Sample string";
  60. char str2[40];
  61. char str3[40];
  62. strcpy (str2,str1);
  63. strcpy (str3,"copy successful");
  64. printf ("str1: %s\nstr2: %s\nstr3: %s\n",str1,str2,str3);
  65. return 0;
  66. }
  67. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement