²é¿´: 2204  |  »Ø¸´: 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 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µÄ»ØÌû
²é¿´È«²¿ 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µÄ»ØÌû

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µÄ»ØÌû
×î¾ßÈËÆøÈÈÌûÍÆ¼ö [²é¿´È«²¿] ×÷Õß »Ø/¿´ ×îºó·¢±í
[½Ìʦ֮¼Ò] ÊÛSCI-T0PÎÄÕ£¬ÎÒ:8O.5.5.1.O.54,¿ÆÄ¿ÆëÈ«,¿É+¼± +3 ASdOkHsho7FD 2026-08-28 5/250 2026-08-29 06:21 by gy1nBQXYQJqL
[²©ºóÖ®¼Ò] ÊÛSCIÎÄÕ£¬ÎÒ:8O.5.5.1O.54,¿ÆÄ¿È«,¿ÉÊ®¼± +3 ASdOkHsho7FD 2026-08-28 4/200 2026-08-29 05:45 by gy1nBQXYQJqL
[»ù½ðÉêÇë] ÎÒ¾ÍÊÇÉêÇëÒ»¸öÃæÉÏÏîÄ¿¶øÒÑ£¬ÕâÆÀÉóÒâ¼ûÊǰ´ÕÕ½ÜÇàµÄÌõ¼þÆÀµÄ°É£¿ +4 gouxfjh 2026-08-28 4/200 2026-08-29 04:46 by alongwaytogo
[˶²©¼ÒÔ°] ÊÛSCIÒ»ÇøÎÄÕ£¬ÎÒ:8.O.55.1.O.54,¿ÆÄ¿ÆëÈ«,¿ÉÙ¤¼± +3 ASdOkHsho7FD 2026-08-28 4/200 2026-08-29 04:18 by gy1nBQXYQJqL
[»ù½ðÉêÇë] ͶƱ:  ÓжàÉÙÈËÊǽñÌì²éϵͳ֪µÀ½á¹ûµÄ£¿ +16 °®¿´ÊéµÄ¿ÉÀÖ 2026-08-26 18/900 2026-08-29 00:28 by winsaint
[»ù½ðÉêÇë] »ù½ð²»ÖУ¬¹²Ãã +11 eulota 2026-08-26 11/550 2026-08-28 14:22 by »ðÐdz¬ÈËxi
[»ù½ðÉêÇë] Â鷳ר¼ÒÃÇ¿´¿´ÆÀίÃǵÄÒâ¼û£¨F¿ÚÃæÉÏ£© +4 gdd2018 2026-08-28 9/450 2026-08-28 14:22 by jklily
[»ù½ðÉêÇë] Ôõô²é°¡ +6 huang1991js 2026-08-26 6/300 2026-08-28 08:42 by winsaint
[»ù½ðÉêÇë] ÉêÇëɾ³ý±¾Ìû +6 lyz123lyz 2026-08-27 7/350 2026-08-27 17:31 by Äþ¾²ÖÂÔ¶sy
[»ù½ðÉêÇë] »ù½ðδÖУ¬ÕâÖÖ´ð¸´ÊÇÄ£°åÂ𣿠+5 zhaosm1982 2026-08-27 6/300 2026-08-27 16:00 by lfy8008
[»ù½ðÉêÇë] ¿´°åÉÏÕâô¶àÖеģ¬ÓеãÏñ50ÈËȺÀï49¸öÈ˶¼ÊÇÆ­×ÓµÄÄÇÖָоõ¡­¡­ +5 a089 2026-08-26 6/300 2026-08-27 14:05 by jonewore
[»ù½ðÉêÇë] Ôõô¿´Çà»ùÖÐÁËûÓа¡ +5 Ò¶¾Å΢ 2026-08-26 5/250 2026-08-27 10:35 by l_zh2008
[»ù½ðÉêÇë] ·¶½øÖоÙÒ»ÎĵÄÖÐÐÄ˼Ïë +9 Ñ׻ƹóëÐ 2026-08-22 10/500 2026-08-26 15:40 by semaglutide
[»ù½ðÉêÇë] 2026Äê8ÔÂ25ÈÕ¹ú×ÔÈ»·Å°ñǰͻȻÊÕµ½ÁÐÈëÆÀÉóר¼ÒÓʼþ£¬ÓйØÏµÂ𣿠+25 ľˮ˼¶¹ 2026-08-25 28/1400 2026-08-26 14:53 by draco1987
[»ù½ðÉêÇë] ÄÜ·ñÍ˳ö²ÎÓëµÄÃæÉÏÏîÄ¿½â³ýÏÞÏî +23 koalala 2026-08-24 26/1300 2026-08-26 14:29 by ±¦±´³æ×Ó
[»ù½ðÉêÇë] ³öÀ´ÁË +9 trojank 2026-08-26 9/450 2026-08-26 14:25 by ±¦±´³æ×Ó
[»ù½ðÉêÇë] Ϊʲô¹ú×ÔÈ»²»ÄÜÖ±½Ó¹«²¼ +4 bjdxyxy 2026-08-26 4/200 2026-08-26 13:12 by qingmu1201
[»ù½ðÉêÇë] ½ñÌìÎñί»á¿ªÍêÁË£¬Ã÷Ìì³ö½á¹ûÂð +19 angus9576 2026-08-25 23/1150 2026-08-26 10:03 by zp519
[Ö°³¡ÈËÉú] ѧÉúײ¼û¸¨µ¼Ô±ËÍÍâÂô£¬µÚ¶þÌìÈ«°à¶¼³ÁĬÁË +3 ¾¨ÓãÈÚ½ð_Õã½­_É 2026-08-22 3/150 2026-08-26 09:01 by zzuzxg
[»ù½ðÉêÇë] ijЩ»ú¹¹£¬ÒÔЧÂʵÍΪÈÙ£¬ÒÔЧÂʵÍ×÷Ϊ´æÔڸР+9 yuleib84 2026-08-25 10/500 2026-08-25 17:14 by alexon
ÐÅÏ¢Ìáʾ
ÇëÌî´¦ÀíÒâ¼û