c/c++ תרגול קוד יעיל - עמוד 7 - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

c/c++ תרגול קוד יעיל


007המקורי

Recommended Posts

פיתאום זה עובד גם עם ה int :)

************************

מחרוזות

(שאלה פשוטה)

קלוט שם ושם מישפחה וצור מחרוזת נוספת המכילה שם פרטי ושם מישפחה.

 #include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <string.h>


int main()
{
int name[20],last_name[20],total[50];
printf ("enter your name!");
gets(name);
printf ("enter your last name!");
gets(last_name);
strcpy(total,name);
strcat(total, " ");
strcat(total,last_name);
puts (total);


getch();

return 0;

}

קישור לתוכן
שתף באתרים אחרים

  • תגובות 96
  • נוצר
  • תגובה אחרונה

---עוד שאלה קלילה----

קלוט מחרוזת והדפס את אורכה.

  #include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <string.h>


int main()

{
char word[100];
int str;
printf ("enter a word!(up to 50 letters) :");
gets(word);
str=strlen (word);
printf(" the len of the `word` %d\n ",str);


getch();

return 0;


}

קישור לתוכן
שתף באתרים אחרים

קלוט שני מחרוזות ובדוק אם הם זהות.

  #include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>


int main()
{
char name[50],name_2[50];
int calculus_cmp=0;
printf ("enter your name!(up to 40 letters)");
gets (name);
printf("enter another name!(up to 40 letters)");
gets (name_2);
calculus_cmp= strcmp(name,name_2);
if (calculus_cmp == 0){
printf("the names are the same!");
}
else
printf("the names are not the same!");





getch();

return 0;

}

קישור לתוכן
שתף באתרים אחרים

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.


×
  • צור חדש...