49,757 Topics
| |
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 | |
Hi! I have a problem to make a list of students (i know how to put all the input and to calculate the average of the students grades) but i don't know how to put the students in new list arrayed by their average form biggest to smallest and if … | |
Hey! I am college student training for exam. Found one problem and I know you'll know what to use straight away. Here we go: We got a file where the excel sheet is encrypted like this: 1;2;3;=A2 ;;1;4;5 ;=580*A;=D2+1 Formulas are just simple ones, max. two numbers and *, /, … | |
what is the usual cause for "out-of-line member function declaration" compiler error? | |
QUESTION: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? I was trying to solve this problem. I was previously suggested to use the "Sieve of Eratosthenes" Method to find the prime nos. [url]http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes[/url] I came up … | |
I was just curious, besides the APIs and DLLs, etc, what is the difference between C++ compiled in windows, and C++ compiled in linux? Is it just the OS interrupts used in the machine code or what? | |
hi i just done my program and the input have some digits gone from it.i don't know how to recorrect it so i will like to seek advice here please [CODE] #include <iostream> #include <cmath> using namespace std; void convert(int , int, int, int*); //convert(number, base, length, result) int len=0, … | |
hi guys! i need help ! what's wrong of this code?? this program will input five names and will output the five names i inputed. but when i run this program and i inputed a five names. It couldn't give me the exact answer.. the output should be this: please … | |
I'm trying to write a program that will calculate rations, max, min, total and average #. I'm told I can use #include <algorithm> but I don't know how to use it. I need it to spit out something similar to the following: How many in the first category? 8 cats … | |
I was wondering if it's possible to ignore certain digits of a number, and how it would be done.It will always be a 21 digit number, and i want it to only use the last 7 digits of the number. Eg: 000J90120071000002291 is the number, and I only want it … |
The End.