הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 07-05-07, 14:00   # 1
mayden
Авторитет
 
מיני פרופיל
תאריך הצטרפות: Apr 2006
הודעות: 2,556

mayden לא מחובר  

[C] בעיה בתוכנית

יש לי את התוכנית הבאה:
קוד:
#include <stdio.h>
#include <string.h>

typedef char string;

void main () {
	string st1="ABCBD";
	string st2="CEB";
	string st3="";
	string sth="";
	int pl=0;
	char tav;
	while(strlen(st1)>0) {
		tav = st1[(strlen(st1)-1];
		strncpy(sth,st1,strlen(st)-1);
		if((strchr(st2,tav)!=null && (strchr(sth,tav) == null)
		{
			st3[pl] = tav;
			pl++;
		}
		strcpy(st1,sth);
	}
	st3[pl]='\0';
	puts(st3);

}
וכשאני מנסה להריץ אותה, כותב לי:
קוד:
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
C:\C\Cpp1.cpp(7) : error C2440: 'initializing' : cannot convert from 'char [6]' to 'char'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\C\Cpp1.cpp(8) : error C2440: 'initializing' : cannot convert from 'char [4]' to 'char'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\C\Cpp1.cpp(9) : error C2440: 'initializing' : cannot convert from 'char [1]' to 'char'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\C\Cpp1.cpp(10) : error C2440: 'initializing' : cannot convert from 'char [1]' to 'char'
        This conversion requires a reinterpret_cast, a C-style cast or function-style cast
C:\C\Cpp1.cpp(14) : error C2664: 'strlen' : cannot convert parameter 1 from 'char' to 'const char *'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\C\Cpp1.cpp(14) : fatal error C1903: unable to recover from previous error(s); stopping compilation
אני משתמש בMicrosoft Visual C++

תודה.
__________________

ציטוט:
" זוכרים בשביל ללמוד, יודעים בשביל ללמד, מבינים בשביל לתכנת.."
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 22:01.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ