49,766 Topics
![]() | |
[icode] someprogram.cpp -----------> #include<string> | | #include"someheader.h" V someheader.h --------------> #include<string> [/icode] what happens if I do this? Is it necessary to include the headers into all files that use them, or can you just go [code=C++] #include<string> #include... #include"someheader.h" #include"anotherheader.h" [/code] and string and other required headers will be … | |
I don't know if this is the right place to post this but here goes nothing. I know this is such a cliche from us C++ coders, but I wanna make my own open source OS. I would use something like BSD or Linux, but I really wanna use C++ … | |
I use this [code] #include <fstream> #include <iostream> using namespace std; class Student { public: char FullName[40]; char CompleteAddress[120]; char Gender; double Age; bool LivesInASingleParentHome; }; int main() { Student one; strcpy(one.FullName, "Ernestine Waller"); strcpy(one.CompleteAddress, "824 Larson Drv, Silver Spring, MD 20910"); one.Gender = 'F'; one.Age = 16.50; one.LivesInASingleParentHome = … | |
Hi, i'm making my own game engine on sdl + opengl i also know that i can manage file for my setting and save game that way (i am on windows) [code] #include <windows.h> void ini::setfile(std::string name) { name += ".ini"; std::string directory; char path[1024]; GetModuleFileName(NULL, path, 1024); directory = … | |
pretty basic problem but my C++ is pretty far back here's my problem I have to read a text file and parse all the different field ex: 001 R0S11 182983 2009/02/22 45607 002 R0S12 182983 2009/02/23 45707 003 R0S13 182983 2009/02/16 45807 004 R0S14 182983 2009/02/04 45907 .... once I've … | |
Hello all i need to be able to modify Microsoft office existing file like or rtf files adding text and misc options to the document and then saving it i don't what to be restricted to windows because most likely the process will be running on Linux . what is … | |
Hi. I'm David a newbie. I have just started Classes in C++ and I'm doing a GPA Calculator program. I have most of the program working but the average calculator seems to be giving me trouble. Please help. This is open to constructive criticism. All inputs will be gladly appreciated. … | |
Which is in higher demand in the job market right now??? | |
[code] #include <iostream> using namespace std; struct Mytime { int hours; int mins; }; int timecmp( Mytime t1, Mytime t2 ) // compares two Mytime values { if (t1.hours == t2.hours) { if (t1.mins == t2.mins) { return 0; // returns 0 if times are same } else // mins … | |
hello,, i need help on how to open files by using variable names.. here's my function: [QUOTE][icode]void stringSearcher(string filename, string search) { ifstream file; file.open(filename); if(!file.is_open()) { cerr<<"File can't be open..."<<endl; exit(1); } string line; while(!file.eof()) { getline(file, line); if(line.find(search)==0) { displayTitle(line); exit(1); } } }[/icode][/QUOTE] my problem is that … | |
what does everyone else use? Another question i have is if there are any significant advantages of VC over Dev? I was figuring out if i should make the switch or not. | |
Hi, I'm pretty new to windows programming, and I'm trying to learn from an example. However, I'm encountering some compiler errors that I think are caused by my strings not being made up of wide characters. (correct me, i could very easily be WAY off) winMain() requires parameters of the … | |
Hello, I am trying to write a program where i have to read a CSV file(obtained by converting an excel file having only 1 column of integers) into an array and then to display the same array as another CSV file. I am using Turbo C++ 4.5. I've tried, but … | |
Hello., Im very new to C++ but im trying to resolve a fragment of the following code: [CODE] #include <iostream> using namespace std; const int NO_STEPS = 4; void s(int* a, int i); int main ( ) { int i, a[NO_STEPS] = {2, 4, 1, 3}; for ( i = … | |
I guys i have questions to answer : if anybody knows the answer please reply the questions : 1. What is objector programming? explain why an object oriented program is more rebust than structured programming?\ 2 Write a recoursive program in C++ to compute factorial of a given integer n … | |
I am currently taking a C++ program at my college and it all just seems foreign to me. I am having some trouble with this problem.. The Yukon Widget Company manufactures widgets that weigh 9.2 pounds each. Write a program that calculates how many widgets are stacked on a pallet, … | |
Hey what I am trying to do is convert the total amount into Euros, what would the calculation be please? The user enters the current rate of Euro Thank you :) | |
Hi, i am new to programming.. i have a code like [CODE]#include<iostream.h> using namespace std; int main() { int x,y; int *p1,*p2; p1=&x; p2=&y; *p1=10; *p2=*p1; p1=p2; *p1=20; cout<< x << y; return 0; } [/CODE] I do not understand it.. output is x =10 and y=20.. But both x … | |
I want to make an if statment that checks for the size of a text file. What is the syntax to declare that? if( txtfile.txt = 5kb || txtfile.txt = 10kb ) { blah blah } ????? thanks | |
[CODE]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include <iostream> using namespace std; int Factorial(int iNum); int main() { int aNum; cout<<"Enter a number: "; cin>>aNum; cout<<Factorial(aNum)<<endl; system("PAUSE"); return 0; } int Factorial(int iNum) { cout<<"We are at number: "<<iNum<<endl; if (iNum <= 1) { cout<<"We are at number: "; return 0; } else { return Factorial(iNum … | |
Hey! Worked on one problem couple days ago and then found code on internet that did almost the same: [CODE] map<string,int> stringCounts; string str; while( cin >> str ) stringCounts[str]++; map<string,int>::iterator iter; for( iter = stringCounts.begin(); iter != stringCounts.end(); iter++ ) { cout << "word: " << iter->first << ", … | |
Hey, i am working on a project in which i am making a minesweeper game. The game part was written by my prof. all i had to do was make the class and header to run the background of the game. I have done so successfully, but i am having … | |
Hi, Guys I am a beginner please help me. I wrote something like this: [CODE=cplusplus] #include <iostream.h> #include <string.h> #define number 1 #define length 35 char student[number][length]; int i,j,k; char *BlankImprover(char *); void InsertInfos(void); void main(){ InsertInfos(); for(i=0;i<number;i++) for(j=0;j<15;j++) cout<<student[i][j]; } void InsertInfos(){ char name[15]; for(i=0;i<number;i++){ cout<<"Enter Student Number <"<<i+1<<"> … | |
am trying to append to file but its not going correctly every time it fail to connect to file [code] #include<iostream> #include<fstream> using namespace std; int main() { fstream file; char word[256]; file.open("StudentInfo.txt",ios::app); //file.open("StudentInfo.txt",fstream::app); // wont work too if(file.fail()) { cout << " Error opening the file " << endl; … | |
Hello, I want to develop a video application using a tv tuner from Aver media Avertv hybrid ultra usb. I need to know how to control the tv tuner: issuing cpmmands such as " pause, read, write, record, timing command etc ". operating system : windows vista. programming language: C++ … | |
hey All. I am currently working on a project to create a basic student registration system using classes and other sorts of stuff later on... as of now, i am to create three classes as follows: Person, Student, and courseInfo. I have to create a simple driver program that allows … | |
How would it be possible to code inside a button that the Browser will open and go to address: [url]http://www.google.com[/url] private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { //Code here to go to: [url]http://www.google.com[/url] ? } | |
i was given an assignment by my prof. , but he stated that using pointer notation . the object t=of the program was to write a C++ function ReverseArray using "pointer notation" that will write out the elements of an array of int in reverse order. his comments were This … | |
Hey! do you know the game snake? well my professor asked us to develop it in c++! It`s crazy!Although he said write a simple program but I`m still confused!Can someone pleassssssssse help me with it? The snake should eat and Its length and score should increase and also do not … | |
can you please give me an article address which tells when to use stack and when to use heap, how to use them properly and the performance issues related to usage. Thanks |
The End.