GOMA smile Posted September 13, 2011 Report Share Posted September 13, 2011 Sveiki man ir jautājums vai manis izveidotais "Skripts" ir pareizs.... Sākumā vadoties pēc šiem matemātiskiem 4 vienādojumiem ir jātiek bie gala rezultāta..... http://www.bildites.lv/images/ogt2u9r5ckcryp6hsfl9.jpg Un pats skripts.... #include <stdio.h> #include <windows.h> #include <math.h> int main (){ int x,a,b,y; printf("Ievadiet X veertiibu:"); scanf("%d",&; a = log(x + pow(x,3)); // Apreikinam a b = 7/(2*x+3) - 5/(2*x*x+3*; // Apreikina b if(a <= y = (log()/pow(a,3) + 2*b/pow(a,4) - b*b/2* pow(a,5); else y = (tan(a))/2*a + (log(tan(b/2))) / 2*b; printf("\n%d",y); system("pause"); return 0; } Vai kāds var pateikt vai man šeit viss ir kārtībā, un kā var pārbaudīt vai ievadītā vērtība X ir skaitlis... Link to comment Share on other sites More sharing options...
w4p1337 Posted September 13, 2011 Report Share Posted September 13, 2011 (edited) int x,a,b,y;spriežot pēč šā, x ir skaitlis, un arī pēc scanf("%d",&x ); ievadītais būs integerā pārveidots. + Kāpēc tev citur b parādās par B? Manliekas, ka tādās valodās vispār viss ir CASE SeNsItIvE Edited September 13, 2011 by w4p1337 Link to comment Share on other sites More sharing options...
GOMA smile Posted September 19, 2011 Author Report Share Posted September 19, 2011 Visas problēmas līdzšim esmu atrisinājis, tikai ne to vai pārbauda vai ievadīts tika skaitlis..., kāds nezin kādu funciju jāizmanto .... ? un sprožot pēc citu teiktā šī ir C nevis C++ ... Link to comment Share on other sites More sharing options...
tranzistors Posted September 19, 2011 Report Share Posted September 19, 2011 Pats nemaz nezini, kādu valodu lieto? Link to comment Share on other sites More sharing options...
GOMA smile Posted September 19, 2011 Author Report Share Posted September 19, 2011 Es līdzšim nezināju ka ir C un C++ domāju ka ir tikai C++ .... Link to comment Share on other sites More sharing options...
Norek Posted October 4, 2011 Report Share Posted October 4, 2011 C ir mirusi valoda. Ja Tev saka C, tad ar to droši vari saprast C++. Izmanto typeof() f-iju. Un kāpēc Tev ir defiinēs mainīgais b, bet if`ā tiek salīdzināts ar B? C++ ir case-sensitive? Es neesmu C++ koderis, tāpēc nemācēšu pateikt, tas ir C vai C++, C# tas nav Link to comment Share on other sites More sharing options...
DoubleT Posted October 5, 2011 Report Share Posted October 5, 2011 tas ir c++ try this - http://paste.php.lv/148c8e41dbf430932499fa42c94b34fd?lang=cpp Link to comment Share on other sites More sharing options...
vincister Posted October 5, 2011 Report Share Posted October 5, 2011 Protams case-sensitive. Un šajā piemērā neredzu neko, kas traucētu kompilēt ar C vai C++ kompilatoru. EDIT: Vispār linux kernelis ir C. Link to comment Share on other sites More sharing options...
worm Posted October 5, 2011 Report Share Posted October 5, 2011 n0r3k, pats tu miris esi... gcc linuxā ir standarts un kompilē C kodu. Atsevišķos gadījumos tiek lietots g++, kas savukārt kompilē C++ kodu Link to comment Share on other sites More sharing options...
0xDEAD BEEF Posted October 5, 2011 Report Share Posted October 5, 2011 Once you go black, you never go back! Reiz sācis programmēt C#, atmiņas par C++ uzdzen reibumu, bet C - spazmas! Beefs Link to comment Share on other sites More sharing options...
remix.cc Posted October 8, 2011 Report Share Posted October 8, 2011 scanf("%d",&x); vajag, lai būtu scanf("%s",string); pēc tam pārveido stringu par skaitli..., itkā man uz datora kkur jābūt kodam, ja vajag, varu iepostot. Link to comment Share on other sites More sharing options...
DoubleT Posted October 9, 2011 Report Share Posted October 9, 2011 (edited) remix nevajag tā. ja liks &x viņš atpazīs kā skaitli un viss būs ok. tikai pirms darbību veikšanas var ielikt do { scanf("%e",&x ); //e pasaka, ka tas būs float ( ja nu vajag komatus ) } while(kamēr x nav cipars); Edited October 9, 2011 by DoubleT Link to comment Share on other sites More sharing options...
remix.cc Posted October 9, 2011 Report Share Posted October 9, 2011 nu nez, nez... man ir tas cygwin kompileris, un, kad es ievadu kaut ko tādu: dasdasdadada %x vietā, parādās daudz erroru un dažreiz kompileris neiztur āa un es runāju par C valodu, jo #1 postā sintakse ir ļoti pazīstama sorry, ja kļūdos. Link to comment Share on other sites More sharing options...
DoubleT Posted October 9, 2011 Report Share Posted October 9, 2011 (edited) mans kods iet ( bez pārbaudes ) kods - http://paste.php.lv/8b7cb9d1586d1cabdec461c4387c713e?lang=cpp Edited October 9, 2011 by DoubleT Link to comment Share on other sites More sharing options...
remix.cc Posted October 9, 2011 Report Share Posted October 9, 2011 (edited) Karoč, izrāvu daļu no koda... int get_integer( char string[] ) { int i = 0, number = 0; // Make loop till '\0' is reached while( string ) { if( string < '0' || string > '9') { // Sheit laikam vnk vajag rakstit return -1, vnk man uzdevums bija citadaks number = -1 ; break ; } number *= 10 ; number += ( string - '0' ) ; i++ ; } return number; } Edited October 9, 2011 by remix.cc Link to comment Share on other sites More sharing options...
GOMA smile Posted November 15, 2011 Author Report Share Posted November 15, 2011 Rekur: itkā viss strādā ... http://paste.php.lv/d34b0fd19c3551f62b2363dad13cf277?lang=c Internetā izlasiju, bet īsti nevaru saprast ko dod isnan(), itkā pārbauda vai skaitlis ir apreiķināms... kkā tā Link to comment Share on other sites More sharing options...
DoubleT Posted November 15, 2011 Report Share Posted November 15, 2011 isnan = is not a number Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now