188 Posted Topics
Re: [QUOTE=bh_hensem;249154]Hi, Actually my program will be read some input, as example :- 123=saya 456=ada 132=buku 321=cerita So, I would like to copy all the data into array or whatever and print it at the end of my program. Could some body help me ?[/QUOTE] Don't understand. The user must enter … | |
Re: First of all [inlinecode]fflush(stdin);[/inlinecode]won't do the work! Read [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044873249&id=1043284392"]this[/URL] and [URL="http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044652485&id=1043284385"]this[/URL] | |
Re: > how about std::accumulate? Don't remember this C statement :) | |
Re: At least you have to try on your own. Then post your code to the forum explaining with which part you have a problem. Even if someone write the code for you the admin would remove it. [URL="http://www.daniweb.com/techtalkforums/announcement125-2.html"]please read this[/URL] Good luck | |
Re: [quote=isamd] [code] decToBin(name[i],2)=answer; [/code] [/quote] This is illegal. What did you want with this line? | |
Re: [QUOTE=Eddy] [CODE] char buffer[2]; buffer[0] = 0x11; buffer[1] = 0x05; buffer[2] = 0x14; [/CODE] [/QUOTE] be carefull, the size of buffer is 2 bytes and U assigned 3 bytes so this is a bug. | |
Re: You don't need double loop. What you need is one foor loop wich will print str[x] and [inlinecode]putchar(' ');[/inlinecode] if its [inlinecode]if (0 == (x % 4) && 0 != x)[/inlinecode] | |
Re: I will assume that you know to work with argc and argv. It should be simple just parse the string argv[2] till the '_' char and then copy what left (from '_' till the end including '\0') to temporary string. Then just use [CODE] if (strcmp(fileExtension, tempString) != 0) { … | |
Re: [CODE] #include <iostream> #include <cstdlib> #include <string> using namespace std; void decToBin(int number, int base); int main() { cout<<"Enter a string: "; string name; getline(cin,name); for (unsigned int i=0; i<name.size(); i++) { cout << name[i] << " binary ("; decToBin(name[i], 2); cout << ")" << endl; } return 0; } … | |
Re: Your Personality Profile [IMG]http://images.blogthings.com/worldsshortestpersonalitytest/green.jpg[/IMG] You are nurturing, kind, and lucky. Like mother nature, you want to help everyone. You are good at keeping secrets and tend to be secretive. A seeker of harmony, you are a natural peacemaker. You are good natured and people enjoy your company. You put people … | |
Re: >> But there is some problem with the code can anyone help me? Some problem? Ok whats this iGetABCFile(char*)? You can't call functions like this You have bunch of variables wich are not declared like: ulNameRecordCount, usSubTypeCode, usSubTypeCode, usFeatureClassCode, aucAttributeType, ucFont. You try to fprintf them to file but not … | |
Re: [QUOTE=star22]thank u my friend but I still find to error --------------------Configuration: zz - Win32 Debug-------------------- Compiling... zz.cpp c:\documents and settings\user\c++\zz.cpp(11) : error C2143: syntax error : missing ';' before '<class-head>' c:\documents and settings\user\c++\zz.cpp(11) : fatal error C1004: unexpected end of file found Error executing cl.exe. zz.exe - 2 error(s), 0 … | |
Re: And the answer is: [CODE] ################################################### # author: Andor Pásztor ################################################### ################################################# # text segment # ################################################# .text .globl main main: la $a0, str1 li $v0, 4 syscall li $v0, 5 syscall or $t0, $v0, $v0 la $a0, str2 li $v0, 4 syscall li $v0, 5 syscall add $t1, $v0, … | |
Re: [QUOTE=sgriffiths]When i try to compile, i get this > gcc string_to_hex.c Undefined first referenced symbol in file itoa /tmp/cc21JKaJ.o ld: fatal: Symbol referencing errors. No output written to a.out collect2: ld returned 1 exit status[/QUOTE] Yes of course itoa is nonstandard. U can implement your own itoa [URL="http://www.daniweb.com/techtalkforums/showthread.php?t=11049&highlight=itoa"]http://www.daniweb.com/techtalkforums/showthread.php?t=11049&highlight=itoa[/URL] or use … | |
Re: the problem is [CODE] #define EOF =-1 [/CODE] [CODE] while ((c = getchar() !=EOF) // problem area :-( [/CODE] replace it with [CODE] #define EOF -1 [/CODE] [CODE] while ((c = getchar()) != EOF) // problem area :-( [/CODE] | |
Re: [CODE]#include<stdio.h> #include<stdlib.h> main() { FILE *fp; char buffer[]="STEPHEN"; fpos_t file_pos; char c; fp = fopen("ste.txt", "rb+" ); fseek(fp, 18, SEEK_SET ); fwrite(buffer, sizeof(buffer), 1, fp); fgetpos(fp, &file_pos ); printf("File Pos :%ld\n", file_pos ); c = getc(fp); printf("Character is : %c\n", c ); fclose(fp); [/CODE] | |
Re: [QUOTE=Ricky_v.s_C++]How can I separate an integer into digits using for loop? eg. before: 123 after: 1 2 3 anyone can help me with that?[/QUOTE] Here is an idea. Convert to char * | |
Re: This is just an idea how can solve your problem [CODE] #include "stdio.h" #include "pthread.h" pthread_t threadEvent; unsigned char breakLoop = 0; void * Exit(void * ptr) { char c = 'a'; scanf("%c", &c); if ( c == 'e') breakLoop = 1; } main() { int i = 0; pthread_attr_t … | |
Re: Why don't you use s[256] so you don't need malloc. Use gets for string input. To calculate spaces (if I understood your task) just iterate the input string example: if (s[index++] == 0x20) numSpaces++; | |
Re: [url]http://www.daniweb.com/techtalkforums/thread43876.html[/url] | |
Re: Compare it with yours and you will see the differences: [CODE] ################################################### # author: Andor Pásztor ################################################### .text .globl __start main: ##execution starts here #--------------------Start Cut--------------------- la $t1, str nextCh: lb $t2, ($t1) beqz $t2, strEnd addi $t4, $zero, 0x61 sub $t3, $t2, $t4 bgez $t3, l1 add $t2, $t2, … | |
Re: I have a question for you. Did you try to debug your code with SPIM simulator? If answer is no then try it. | |
Re: You mean functions? Try to find open source decoders (very hard process) wich decode the file and send the raw pcm data to audio device. Writing decoder on your own without experiance is insane. Wish you luck | |
| |
Re: In getMonth() and getYear() dont return EXIT_SUCCESS | |
Re: Post the problem to linux forum or try to search the solution trought other linux forums (which will give you faster time to solve the problem). I'm sure that the problem occured to others. | |
Re: Use some editor to create example x.cpp. Then try to compile with g++ -o x x.cpp (without additional library) and run it with ./x command. Type this lines in console. If error occures then use google to check them. I think that knoppix has gcc and g++ included in it. | |
Re: [QUOTE=c21ahongyi]addi $t0, $s0,48 beq $t1, $t0, L1 L2: lw $t1, 16($t0) srl $t2, $t1,3 bne $t2, $t0, L2 L1: sw $t2, 32($t1) ori $s0, $s0, 0xFF7F j L1 if the machine code equivalent to the above MIPS codes is loaded in memory at starting address 0xd24fc91c, wat exact binary values … | |
Re: You can't load word [CODE]lw $t1, 5($s1)[/CODE] becouse 5 isn't divisable with 4 so you also can't do this [CODE]addi $s1, $s1, 11[/CODE] and then [CODE]lw $t3, -8($s1)[/CODE] the rest is correct so $t0 is 0xFFFFFF9d and $t2 is 0x000000fa. For learning MIPS you can use SPIM (yes revers from … | |
Re: i'm not sure if I understood the problem but try to replace [CODE]if (num % fac == 0)[/CODE] with [CODE]if ((num % fac == 0) && (num != fac))[/CODE] and use this [CODE]void printPrimes (int num) { int number = 2; while(number <= num) { if (isPrime(number)) cout << number<<" … | |
Re: You have errors what's this [CODE]private: int const ArraySize; int const [40]; int intConversion(char); void CopyArray( int[], const int[]);[/CODE] int const [40] :?: do you mean int number[40]. Try to fix the errors | |
Re: I need to write a program that takes in the values to a 4x5 two dimensional array of integers,then searches the array for values that are less than 0(zero)and displays these values along with there row and column indices.. Anyone have any ideas...newbie #include <stdio.h> #define MAX_ROW 5 #define MAX_COLUMN … | |
Re: in first example counting the words at the begining of every word, in second example counting the words at following space (0x20). Try to add space after 'project'. | |
Re: one of the way is cin.getline but you must specify the delimiter (maybe '.') [CODE] #include <iostream.h> void main() { char str[20]; cin.getline(str, 20, '.'); cout << str << endl; } [/CODE] | |
Re: Maybe U should try with switch . . . cin>>c; switch(c) { case 1: cout<<"Enter the number of dice to roll..."; cin>>n; cout<<"in groups of how many? "; cin>>g; D4(n,4); break; . . . default: cout<<"That is not a valid selection!\n"<<"\n"; break; } and also try to avoid globals | |
Re: :lol: really u did it that no one cant yet now , really it is a amazing book for the c programmers bcoz in none of the book explain in this so simple way and the language is easy too.till i have read only 10 chapters, so i cna conclude … |
The End.