- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 1
- Upvoting Members
- 2
- Downvotes Received
- 5
- Posts with Downvotes
- 3
- Downvoting Members
- 4
25 Posted Topics
In my opinion SFML is the best library you can use with c++, I tried SDL, Allegro and SFML is very easy to understand/use. There is even a book with a real project implemented step by step.
I'm trying to understand how the function encrypt works (linux), but event with this simple example is not working. Any ideas?. Thank you. #define _XOPEN_SOURCE #include <unistd.h> #include <stdlib.h> #include <iostream> #include <string> int main() { const char key[64] = "12" ; /* bit pattern for key */ char txt[64] …
To insert the struct you can use the vector method push_back. #include <iostream> #include <vector> #include <string> struct DATE { int day; int month; int year; }; struct onDutyRecords { std::string name; double sunshine; double rainfall; double midTemp; DATE date; }; int main() { std::vector<onDutyRecords> records; DATE today; today.day = …
I'm not understanding why i'm able to read from the file but i can't write to it. The fstream is open in both modes. Once the program finishes i haven't changed the content of the file. Thank you in advance. #include <fstream> #include <string> #include <iostream> int main() { std::string …
What about this : #include <fstream> #include <string> int main() { std::ifstream m_File("/home/user/file_name.txt", std::ios::in); std::filebuf* pbuf = m_File.rdbuf(); std::size_t size = pbuf->pubseekoff(0, m_File.end, m_File.in); pbuf->pubseekpos(0, m_File.in); char* buffer = new char[size]; pbuf->sgetn(buffer, size); std::string text(buffer); return 0; }
[QUOTE=mosespascal;1110663]I am a first year engineering student and i am very intresred in programming using c++ basically to use it in creating my own search engine.Please anyone to help in step by step as I have started learnig c++ language because I dont have prior kowledge in programming.[/QUOTE] The first …
Hi, I'm trying to convert a void pointer to a struct pointer.. that's seems very easy but my compiler give me error. Thanks. /home/subi/Personal/Projects/LinkedListUserInfo/main.cpp||In function ‘error_t parse_opt(int, char*, argp_state*)’:| /home/subi/Personal/Projects/LinkedListUserInfo/main.cpp|50|error: expected primary-expression before ‘)’ token| /home/subi/Personal/Projects/LinkedListUserInfo/main.cpp|50|error: expected ‘;’ before ‘null_pointer’| /home/subi/Personal/Projects/LinkedListUserInfo/main.cpp|48|warning: unused variable ‘null_pointer’| ||=== Build finished: 2 errors, 1 …
[QUOTE=PDB1982;1136798]I see what you're saying about that variable, but I think that's fine to stay the way it is, because that will be established each time the user inputs the miles (i.e. the efficiency will change for each trip). The problem I'm trying to figure out is why my OdomterReading …
[QUOTE=invisi;1130346]I love this programme :P [CODE]#include <iostream> #include <string> using namespace std; char lowerCase(char input0 = 0); char upperCase(char input1 = 0); int main() { char character = 0; while(true) { cout << "Enter a Character to change case: "; cin >> character; cout << endl; if(character > 64 && …
[QUOTE=evstevemd;1129608]I have started searching long ago and haven't find one. Ye there are sites like buddy pointed above but not Manuals to download. I wonder why they dont release one[/QUOTE] I usually use this [URL="http://www.gnu.org/software/libc/manual/"]gnu c library[/URL] is not about c++ but it has a very concrete description on c …
[QUOTE=stjohn999;1117172]this is my daughters homework she asked me to help and now im stuck she has worked it out and is making me look stupid need to get my selfrespect back even if i have to cheat(i used my brain and im asking you) the code is as follows but …
[QUOTE=gayatridevi;1116211]hi, I V.Gayatri Devi I am writing the c code in linux for distance calculation using haversine formula I included in my program as #include <math.h> but the sine functions and squareroot functions are not working in my program. instead of using math.h i also used cmath.h but there is …
[QUOTE=wot;1113585]Hey guys, I'm new to C and I am trying to find a way to create a file with the following array: [code] char peer1_0[] = { 0x0c, 0x4c, 0x08, 0x00 }; [/code] The original array has a lot more data, but I am just needing a simple example or …
[QUOTE=Dimitar;1105162]I'm new to posting online, but I guess I should have given more info :) Here is the code I managed to write and the input file.[/QUOTE] try something like this, i fill a vector of vectors with the values find in the file.. is not finished but i could …
[QUOTE=jerim;1110427]I am working on a class assignment that doesn't meet for a few more days. The assignment is to open a text file, and parse the file one word at a time, reading each word into one of 26 arrays based on the first letter of the word. I can …
[QUOTE=popo_prince;27331]i can't get this to run. my math functions at the end have messed up logic. and the superfluous function headers and such. i don't think the math output is linked to the desired output of the payment. [CODE] #include <iostream.h> #include <math.h> #include <cstdlib> #include <iomanip> //here i am …
[QUOTE=C++ Beginner;1105392]Problem: Write a program that has an array of at least 20 integers. It should call a function that uses the linear search algoritm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The …
[QUOTE=codezy;1104091]hii ,, i have a sorted array x[]={1,2,10}, and a "target" i want to search recursively for the sum of the elements of the array with any combination without any repetition of elemt in the array (i.e. if target=11 then we can get it from the array (1+10) but if …
[QUOTE=nerdinator;1101343]How to make a time based regular function?Like something that plays a sound every 1 second?[/QUOTE] well, with the information that you provide this could work: [CODE] #include <iostream> using namespace std; void doSomething(); int main() { int waittime = 5; // 5 seconds while(1) { doSomething(); sleep(waittime); } } …
[CODE] void reverse(string word, int l) { int j=0; char rev[l]; for(int i=l-1; rev[i]>=0; i--) rev[j++]=word[i]; rev[j]='\0'; cout<<"The word after reversing --> "<<rev<<endl; }[/CODE] Now works!
[QUOTE=manosha;1091376]yES , i DID but no change.[/QUOTE] [CODE] void Square::draw(char ch) { for (int line=0;line<=sidelength-1;line++) { if(line == 0 || line == sidelength-1) { // draw the whole line for (int loop=1;loop<=sidelength;loop++) cout<<ch; } else { // draw inside line cout<<ch; for (int loop=1;loop<=sidelength-2;loop++) cout<<" "; cout<<ch; } cout<<endl; } …
[QUOTE=MKO;1091197]:-/I'm getting the following error when I debug this small test programm . I can't find anything wrong with it. Even on MSDN they come up with a two line sample code which generates that fault code. In other words, they have no clue either. I hope that some one …
Hi, I don't know why the member variable of my class is getting a wrong value. I just want to copy a char array to member variable that is also a char array. What is wrong? Thanks! [CODE]// constructor filewatcher::filewatcher(char filename[]) { // filename to watch strcpy(this->_filename, filename); }[/CODE]
good start, using the same program i'd do this little changes. [CODE]#include <iostream> #include <windows.h> //---------------------------- using namespace std; //---------------------------- int main () { int numbers = 1; do { cout << numbers*numbers << "\t\t\t" << numbers << "\n"; numbers++; Sleep(500); } while (true); }[/CODE]
Hi, I'm just starting to practice with c++ and I'd like to know if there is a good way to handle the errors/exception. I write this program to check the modification time of a file. Thanks [CODE]int filewatcher::watch() { struct stat filestatus; stat(this->_filename, &filestatus); if((filestatus.st_mode & S_IFMT) == S_IFREG) { …
The End.
jBat