±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 1925  |  »Ø¸´: 5

zyj8119

ľ³æ (ÖøÃûдÊÖ)


[½»Á÷] ¡¾ÇóÖú¡¿macµÄ±àÒë»·¾³xcodeµÄʹÓÃÎÊÌâ

´Ë³ÌÐò£¬ÓÃvisual studio±àÒëÍêȫûÓÐÎÊÌ⣬µ«ÊÇÓÃmacϵÄxcode±àÒ룬ȴÓÐ11¸ö´íÎ󣿣¿£¿
CODE:
#include
#include
#include
#include

using namespace std;
class ffts
{
private:
        double a,b,eps,integ;
public:
        ffts(double aa,double bb,double es)
        {a=aa;b=bb;eps=es;}
        void integration();
        void output();
        double func (double);
};

void ffts::integration()
{
        int n,k;
        double fa,fb,h,t1,p,s,x,t;
        fa=func(a);fb=func(b);
        n=1;h=b-a;
        t1=h*(fa+fb)/2.0;
        p=eps+1.0;
        while(p>=eps)
        {
                s=0.0;
                for(k=0;k                 {
                        x=a+(k+0.5)*h;
                        s=s+func(x);
                }
                t=(t1+h*s)/2.0;
                p=fabs(t1-t);
                t1=t;n=n+n;h=h/2.0;
        }
        integ=t;
}

void ffts::output()
{
        char str2[20];
        cout<<"\nÊä³öÎļþÃû:"£»
        cin>>str2;
        ofstream fout(str2);
        if(!fout)
        {cout<<"\n²»ÄÜ´ò¿ªÕâ¸öÎļþ"<         fout<         fout.close();
}

double ffts::func(double x)
{ return exp(-x*x);£ý
       
void main()
{
        ffts solution(0.0,1.0,0.000001);
        solution.integration();
        solution.output();
}

Build 1 of project 1 with configuration Debug

CompileC build/1.build/Debug/1.build/Objects-normal/x86_64/main.o main.c normal x86_64 c com.apple.compilers.gcc.4_2
cd /Users/apple/Documents/1
setenv LANG en_US.US-ASCII
/Developer/usr/bin/gcc-4.2 -x c -arch x86_64 -fmessage-length=0 -pipe -std=gnu99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/SDKs/MacOSX10.6.sdk -mfix-and-continue -mmacosx-version-min=10.6 -gdwarf-2 -iquote /Users/apple/Documents/1/build/1.build/Debug/1.build/1-generated-files.hmap -I/Users/apple/Documents/1/build/1.build/Debug/1.build/1-own-target-headers.hmap -I/Users/apple/Documents/1/build/1.build/Debug/1.build/1-all-target-headers.hmap -iquote /Users/apple/Documents/1/build/1.build/Debug/1.build/1-project-headers.hmap -F/Users/apple/Documents/1/build/Debug -I/Users/apple/Documents/1/build/Debug/include -I/Users/apple/Documents/1/build/1.build/Debug/1.build/DerivedSources/x86_64 -I/Users/apple/Documents/1/build/1.build/Debug/1.build/DerivedSources -c /Users/apple/Documents/1/main.c -o /Users/apple/Documents/1/build/1.build/Debug/1.build/Objects-normal/x86_64/main.o

/Users/apple/Documents/1/main.c:2:21: error: iostream.h: No such file or directory
/Users/apple/Documents/1/main.c:3:20: error: fstream.h: No such file or directory
/Users/apple/Documents/1/main.c:4:18: error: cmath.h: No such file or directory
/Users/apple/Documents/1/main.c:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'
/Users/apple/Documents/1/main.c:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ffts'
/Users/apple/Documents/1/main.c:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
/Users/apple/Documents/1/main.c:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
/Users/apple/Documents/1/main.c:45: error: stray '\357' in program
/Users/apple/Documents/1/main.c:45: error: stray '\274' in program
/Users/apple/Documents/1/main.c:45: error: stray '\233' in program
/Users/apple/Documents/1/main.c:54: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token

[ Last edited by zyj8119 on 2011-4-5 at 20:28 ]
»Ø¸´´ËÂ¥

» ²ÂÄãϲ»¶

» ±¾Ö÷ÌâÏà¹Ø¼ÛÖµÌùÍÆ¼ö£¬¶ÔÄúͬÑùÓаïÖú:

» ÇÀ½ð±ÒÀ²£¡»ØÌû¾Í¿ÉÒԵõ½:

²é¿´È«²¿É¢½ðÌù

ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
¡ï
zyj8119(½ð±Ò+1):лл²ÎÓë
zyj8119(½ð±Ò+10): ¾ÍÊÇÏëÊÔÒ»ÏÂXCODE. 2011-04-05 19:57:55
Äú»¹ÊÇÏÈѧϰһÏÂnamespaceÕâ¸öÍæÒâ¶ù°É
2Â¥2011-04-05 15:54:33
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

sudo

ľ³æ (ÕýʽдÊÖ)


¡ï
zyj8119(½ð±Ò+1):лл²ÎÓë
zyj8119(½ð±Ò+10): µÄÈ·£¬ÎÒÓÃVC6.0ÔËÐÐÎÊÌâ¾Í²»´ó¡£¡£¡£ 2011-04-05 19:58:28
Ò»ÑÛ¿´¹ýÈ¥¾Í·¢ÏÖÓÐÖÐÎÄ×Ö·û´íÎóºÍȱ´óÀ¨ºÅ´íÎó£¬ÇëÂ¥Ö÷ÏÈÈÏÕæ¼ì²éÔÙÌù¹ýÀ´...

Áí£º
1. void main()²»ºÏ±ê×¼£¬lzÊÜVC6»òÒÔǰ°æ±¾¶¾º¦ÁË

2. ¹ØÓÚÍ·Îļþ£º
#include
#include
#include
#include
²ÅÊÇÐÂʽµÄд·¨

3. ËäÈ»gccÊÇÄܱàÒëc++³ÌÐò£¬²»¹ýÐèÒª¸ÄһЩ²ÎÊý¡£Ã»Óùýxcode£¬ÎÒÏëÈç¹ûÕýÈ·½¨Á¢C++ projectµÄ»°£¬IDEÓ¦¸ÃÊÇÄÜ×Ô¶¯Ñ¡ÓÃg++±àÒëÆ÷µÄ¡£àÅ£¬Èç¹û²»ÄÜ£¬ÊÖ¶¯°Ñ±àÒëÆ÷´Ógcc¸ÄΪg++¡£ÕâÓ¦¸ÃÊÇ×î·½±ãµÄ×ö·¨
3Â¥2011-04-05 16:26:47
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

zyj8119

ľ³æ (ÖøÃûдÊÖ)


ÒýÓûØÌû:
Originally posted by sudo at 2011-04-05 16:26:47:
Ò»ÑÛ¿´¹ýÈ¥¾Í·¢ÏÖÓÐÖÐÎÄ×Ö·û´íÎóºÍȱ´óÀ¨ºÅ´íÎó£¬ÇëÂ¥Ö÷ÏÈÈÏÕæ¼ì²éÔÙÌù¹ýÀ´...

Áí£º
1. void main()²»ºÏ±ê×¼£¬lzÊÜVC6»òÒÔǰ°æ±¾¶¾º¦ÁË

2. ¹ØÓÚÍ·Îļþ£º
#include <cstdio>
#include <iostream ...

CODE:
#include
#include
#include

using namespace std;
class ffts
{
private:
        double a,b,eps,integ;
public:
        ffts(double aa,double bb,double es)
        {a=aa;b=bb;eps=es;}
        void integration();
        void output();
        double func (double);
};

void ffts::integration()
{
        int n,k;
        double fa,fb,h,t1,p,s,x,t;
        fa=func(a);fb=func(b);
        n=1;h=b-a;
        t1=h*(fa+fb)/2.0;
        p=eps+1.0;
        while(p>=eps)
        {
                s=0.0;
                for(k=0;k                 {
                        x=a+(k+0.5)*h;
                        s=s+func(x);
                }
                t=(t1+h*s)/2.0;
                p=fabs(t1-t);
                t1=t;n=n+n;h=h/2.0;
        }
        integ=t;
}

void ffts::output()
{
        char str2[20];
        cout<<"\nÊä³öÎļþÃû:";
        cin>>str2;
        ofstream fout(str2);
        if(!fout)
        {cout<<"\n²»ÄÜ´ò¿ªÕâ¸öÎļþ"<         fout<         fout.close();
}

double ffts::func(double x)
{ return exp(-x*x);}
        
void main()
{
        ffts solution(0.0,1.0,0.000001);
        solution.integration();
        solution.output();
}

[ Last edited by zyj8119 on 2011-4-5 at 20:30 ]
4Â¥2011-04-05 20:29:11
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

sudo

ľ³æ (ÕýʽдÊÖ)


zyj8119(½ð±Ò+8): ллÌáÐÑ£¡£¡£¡£¡ 2011-04-05 22:58:54
ÒýÓûØÌû:
Originally posted by zyj8119 at 2011-04-05 20:29:11:
[code]#include<iostream>
#include<fstream>
#include<cmath>

using namespace std;
class ffts
{
private:
        double a,b,eps,integ;
public:
        ffts(double aa ...

Ç°ÃæÔÙ¼ÓÉÏ
#include
ÒòΪÀïÃæµ÷ÓÃÁËexit(1);

È»ºóÔÙ°Ñvoid main()¸Ä³Éint main()

ÔÚÎÒÕâÀïÓÃg++±àÒë¾ÍûÓÐÎÊÌâÁË

ËäȻûʹÓùýxcode£¬²»¹ýËüµÄc/c++±àÒëÆ÷Ò²ÊÇgccºÍg++£¨ËäÈ»¾Ý˵ÊÇÆ»¹û¹«Ë¾¸Ä¹ýµÄ£©£¬Ó¦¸ÃÊDz¶àµÄ


Â¥Ö÷¿´¿´ÏÂÃæÕâЩIDE³£¼ûµÄ²½ÖèÓÐûÓвο¼¼ÛÖµ£º

´ò¿ªIDE£¬Ñ¡Ôñн¨¹¤³Ì(new project)£¬È»ºóÑ¡ÀïÃæµÄc++¹¤³Ì£¨ÕâÑùIDE»á×Ô¶¯¸øÄãÅäºÃ±àÒëÆ÷Ñ¡Ï£¬ÕâÑùÓ¦¸Ã»á³öÏÖÒ»¸öÃüÃûÀàËÆmain.cppÑù×ÓµÄÎļþ£¬È»ºóÔÙ°Ñ´úÂëÌù½øÈ¥ÊÔÊÔ¿´

µ±È»ÁË£¬Èç¹ûÂ¥Ö÷¶ÔxcodeµÄÅäÖñȽÏÁ˽âµÄ»°£¬Ö±½Ó½«±àÒëÆ÷Åä³Ég++¾ÍÐÐÁË£¬ÄÇЩ±¨´íµÄÖ÷ÒªÔ­ÒòÊÇ£º°ÑC++³ÌÐòµ±³ÉC³ÌÐòÀ´±àÒëÁË...
5Â¥2011-04-05 22:11:39
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû

zyj8119

ľ³æ (ÖøÃûдÊÖ)


ÒýÓûØÌû:
Originally posted by sudo at 2011-04-05 22:11:39:
Ç°ÃæÔÙ¼ÓÉÏ
#include<cstdlib>
ÒòΪÀïÃæµ÷ÓÃÁËexit(1);

È»ºóÔÙ°Ñvoid main()¸Ä³Éint main()

ÔÚÎÒÕâÀïÓÃg++±àÒë¾ÍûÓÐÎÊÌâÁË

ËäȻûʹÓùýxcode£¬²»¹ýËüµÄc/c++±àÒëÆ÷Ò²ÊÇgccºÍg++£¨ËäÈ»¾Ý˵ÊÇ ...

лл½¨Òé¡£¡£¡£¡£¡£
6Â¥2011-04-24 16:18:04
ÒÑÔÄ   »Ø¸´´ËÂ¥   ¹Ø×¢TA ¸øTA·¢ÏûÏ¢ ËÍTAºì»¨ TAµÄ»ØÌû
Ïà¹Ø°æ¿éÌø×ª ÎÒÒª¶©ÔÄÂ¥Ö÷ zyj8119 µÄÖ÷Ìâ¸üÐÂ
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] µ÷¼Á +4 ²»·ê´º 2026-04-05 4/200 2026-04-05 18:07 by ms629
[¿¼ÑÐ] 296Çóµ÷¼Á +3 Íô£¡£¿£¡ 2026-04-05 5/250 2026-04-05 17:38 by À¶ÔÆË¼Óê
[¿¼ÑÐ] 285Çóµ÷¼Á +5 AZMK 2026-04-04 7/350 2026-04-05 17:16 by yulian1987
[¿¼ÑÐ] ²ÄÁÏÓ뻯¹¤371Çóµ÷¼Á +10 ÅãÁÕ¿´º£ 2026-04-04 11/550 2026-04-05 15:26 by luoyongfeng
[¿¼ÑÐ] ²ÄÁϹ¤³Ì302·ÖÇóµ÷¼Á +7 zyxÉϰ¶£¡ 2026-04-04 7/350 2026-04-05 13:52 by imissbao
[¿¼ÑÐ] 0854Çóµ÷¼Á +4 assdll 2026-04-03 4/200 2026-04-04 22:17 by hemengdong
[¿¼ÑÐ] 301Çóµ÷¼Á +18 ÂæÍÕÄÐÈË 2026-04-02 18/900 2026-04-04 20:33 by À¶ÔÆË¼Óê
[¿¼ÑÐ] 085602 ÕÒµ÷¼Á +4 ÄæÊ±Õë¿ìÀÖ 2026-04-02 4/200 2026-04-04 19:32 by À¶ÔÆË¼Óê
[¿¼ÑÐ] 292Çóµ÷¼Á +11 2022080213 2026-04-04 13/650 2026-04-04 18:38 by macy2011
[¿¼ÑÐ] 293·ÖÇóµ÷¼Á£¬ÍâÓïΪ¶íÓï +6 ¼ÓÒ»Ò»¾Å 2026-03-31 6/300 2026-04-04 14:57 by ´ÏÃ÷µÄ´óËÉÊó
[¿¼ÑÐ] Çó²ÄÁϵ÷¼Á£¬Ò»Ö¾Ô¸Ö£ÖÝ´óѧ289·Ö +15 ˶ÐǸ° 2026-04-03 15/750 2026-04-04 01:01 by userper
[¿¼ÑÐ] Çóµ÷¼Á +3 usbdndj 2026-04-03 3/150 2026-04-03 14:10 by dxiaoxin
[¿¼ÑÐ] Çóµ÷¼Á +3 ÐÄÏëÊÂ³É¿É 2026-04-03 3/150 2026-04-03 11:22 by wangjy2002
[¿¼ÑÐ] ²ÄÁÏÇóµ÷¼Á +10 ÄØÄØÄÝÄÝ 2026-04-01 13/650 2026-04-02 09:17 by olim
[¿¼ÑÐ] °²È«¹¤³Ì 285 Çóµ÷¼Á +3 Xinyu56 2026-04-01 4/200 2026-04-01 21:50 by ¾²¾²¾²¾²¾²¾²¾²¾
[¿¼ÑÐ] Çóµ÷¼Á0703 +5 ÖܼÎÒ¢ 2026-03-31 8/400 2026-04-01 20:32 by ltltkkk
[¿¼ÑÐ] 318Çóµ÷¼Á +8 ÆßÒä77 2026-04-01 8/400 2026-04-01 10:37 by Jaylen.
[¿¼ÑÐ] ¿¼ÑвÄÁϹ¤³Ì351·Öµ÷¼Á +5 Õû¸öºÃµÄ 2026-03-31 5/250 2026-04-01 09:36 by topgun2009
[¿¼ÑÐ] µ÷¼ÁÉêÇë +8 ÕÅÕÅÕÅÕÅzy 2026-03-31 9/450 2026-04-01 08:29 by zjbkx
[¿¼ÑÐ] Ò»Ö¾Ô¸Î÷½»´ó080500²ÄÁÏѧ˶349 +6 jqx1258 2026-03-31 7/350 2026-03-31 21:08 by yuq
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û