±±¾©Ê¯ÓÍ»¯¹¤Ñ§Ôº2026ÄêÑо¿ÉúÕÐÉú½ÓÊÕµ÷¼Á¹«¸æ
²é¿´: 1926  |  »Ø¸´: 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

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


ÒýÓûØÌû:
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µÄ»ØÌû
²é¿´È«²¿ 6 ¸ö»Ø´ð
¡ï
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µÄ»ØÌû

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µÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[¿¼ÑÐ] Ò»Ö¾Ô¸ ½­ÄÏ´óѧ 085602 »¯¹¤×¨Ë¶ 338·ÖÇóµ÷¼Á +8 ·³ÕСç÷ 2026-04-05 8/400 2026-04-05 16:25 by imissbao
[¿¼ÑÐ] 302·Ö 085601Çóµ÷¼ÁÍÆ¼ö +8 zyxÉϰ¶£¡ 2026-04-05 8/400 2026-04-05 12:21 by Î޼ʵIJÝÔ­
[¿¼ÑÐ] 285Çóµ÷¼Á +11 ŶßϺôo 2026-04-04 11/550 2026-04-05 08:15 by 544594351
[¿¼ÑÐ] Ò»Ö¾Ô¸Ö£ÖÝ´óѧ²ÄÁÏÓ뻯¹¤085600£¬Çóµ÷¼Á +24 ³ÔµÄ²»ÉÙ 2026-04-02 24/1200 2026-04-04 23:20 by ÓÀ×ÖºÅ
[¿¼ÑÐ] Çóµ÷¼Á +7 xzghyuj 2026-04-04 7/350 2026-04-04 22:25 by oooqiao
[¿¼ÑÐ] Ò»Ö¾Ô¸»ª±±µçÁ¦´óѧ£¨±±¾©£©£¬²ÄÁÏ¿ÆÑ§Ó빤³Ìѧ˶265£¬Çóµ÷¼Á +11 yelck 2026-04-03 12/600 2026-04-04 19:52 by dongzh2009
[¿¼ÑÐ] ²ÄÁÏרҵ383Çóµ÷¼Á +8 ¹ùÑôÑôÑô³É 2026-04-03 8/400 2026-04-04 10:29 by Rednal.
[¿¼ÑÐ] 283·Ö²ÄÁÏÓ뻯¹¤Çóµ÷¼Á +29 ÂÞKAKA 2026-04-02 29/1450 2026-04-03 23:56 by userper
[¿¼ÑÐ] 0856£¬269·ÖÇóµ÷¼Á +15 ÓÐѧÉϾÍÐÐÇóÇóÁ 2026-03-30 18/900 2026-04-03 16:50 by melodiousnow
[¿¼ÑÐ] Çóµ÷¼Á²»Ìôרҵ +3 xrh030412 2026-04-01 3/150 2026-04-03 14:40 by µªÆøÆøÆø
[¿¼ÑÐ] Çóµ÷¼Á +9 akdhjs 2026-03-31 11/550 2026-04-03 13:32 by akdhjs
[¿¼²©] É격ÇóÖú +3 Reee1Llll 2026-04-01 3/150 2026-04-02 22:29 by ÕâÊÇÒ»¸öÎÞÁĵÄê
[¿¼ÑÐ] 348Çóµ÷¼Á +11 zzzzyk123 2026-04-01 11/550 2026-04-02 16:52 by Wang200018
[¿¼ÑÐ] 346Çóµ÷¼Á +5 Ö£³ÏÀÖ 2026-04-02 5/250 2026-04-02 16:38 by SZW_UJN
[¿¼ÑÐ] °²È«¹¤³Ì 285 Çóµ÷¼Á +3 Xinyu56 2026-04-01 4/200 2026-04-01 21:50 by ¾²¾²¾²¾²¾²¾²¾²¾
[¿¼ÑÐ] 307·ÖÇóµ÷¼Á +14 (o~o) 2026-03-31 15/750 2026-04-01 20:43 by longlotian
[¿¼ÑÐ] 0703Ò»Ö¾Ô¸ÄÏʦ´ó334Çóµ÷¼Á +4 seven7yu 2026-03-30 4/200 2026-04-01 16:10 by oooqiao
[¿¼ÑÐ] 322Çóµ÷¼Á +8 ÈýË®sss 2026-04-01 8/400 2026-04-01 10:19 by ÌÆãå¶ù
[¿¼ÑÐ] 0710ÉúÎïѧÇóµ÷¼Á£¡ +6 ÐðÊöÎÄ 2026-03-31 6/300 2026-04-01 09:39 by JourneyLucky
[¿¼ÑÐ] 085602 »¯Ñ§¹¤³Ìר˶ 340·ÖÇóµ÷¼Á +4 qianbai11 2026-03-29 4/200 2026-03-30 11:34 by ÌÆãå¶ù
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û