51,593 Topics
![]() | |
My program works properly under windows, however, it seg faults when I try to compile/run it under linux. [code=c++] #include <fstream> #include <iostream> using namespace std; int main() { char command; char infilename[80]; char outfilename[80]; char fileline[80]; char nextline[80]; char temp[80]; char temp2[80]; char * location; char sentence[250]; int loc … | |
I have an array that has read from file as follows: 1 0 0 2 0 0 3 1 2 4 1 2 5 3 0 For the first two lines ( the ones that end 0 0) I want to enter two additional sets of data, so an additional … | |
Hello guys! Im new in this forum and I hope to say for a long time since I'm new im programming right now. Anyways, I have a big doubt on one assigment I have. I am not going to ask you to do it for me. What I want to … | |
I used turbo c++ to make a program.....the program has lots of different menus with big graphical text (used outtextxy())...the problem is when i run the program, after going thorugh a couple of menus, all the big graphical text (GOTHIC_FONT etc...) changes to DEFAULT_FONT ....what could be a possible reason … | |
Hi am so stuck with the following question, I have input my code at the bottom and it gets me the following display Data items in original order 2 6 4 8 10 12 89 68 45 37 Data items in ascending order 2 4 6 8 10 12 37 … | |
hi there, creating a structured databse (maybe in SQL) that I want accessable from a UI in c#. Is SQL the best way to go about this ? cheers | |
Hi I am new here and I got no programming skills at all, but I think this tool is very easy to write. Please do me a favor. This is how the tool works, you open a ini text file. In the ini file there is something called "Weapon" that … | |
Hey all, I am continuing with my self study and now I have come across classes. I have read about this and read about this but it seems very alien to me.The problem I have selected to do is as follows: Here is a rather simple class definition: [code=c++] class … | |
It is late here, I am tired. I know this is probably out there somewhere, and that I am not showing effort by not looking for it, but I really am too tired, so tomorrow morning if this is answered (takes you like 2 seconds to answer it) I'll mark … | |
hi I am trying to write into a file which already has something in it. like for example i have x y z in the file and if i want to put k after x,y and z like x y z k. my code goes this way [code=c++] int main … | |
i would like to create a program that converts a number system to another i found few ideas on how to do this but lacks explanation so i can't figure out 'how it worked'. found that 'for loop' over the net,did some editing then applied it in a program. here's … | |
hi. i'm planning to use visualc++ as the language for a pcb layout artist/designer. i'm wondering if it's possible to create a command line interface (just like in AutoCAD) using visualC++. | |
Could please help me in the code,of how to extract the no of words in each sentence(if there are 2 or more sentence).But i want the code to use string function????????? | |
here's my code: [code=c++]cin>>figure; switch (figure) { case '1': //figure is circle system("cls"); cout<<"input radius: "; cin>>rad; cout<<"\nsurface area of your circle is "<<pi*rad*rad; break; case '2': //figure is rectangle system("cls"); cout<<"input length: "; cin>>length; cout<<"\ninput width: "; cin>>width; cout<<"\nsurface area of your rectangle is "<<length*width; break; }[/code] 1)when i … | |
I want to send data(image and vedio file ) from client machine to server , I am having a url "http://localHost/prabhat/vedioolad?vedio=&image=" how to send the image and vedio file through this url in VC++ | |
Can somebody help me with this code. The program need to repeat until the user wants to quit. [code]#include<conio.h> #include<iostream> #include <cstdlib> #include <stdlib.h> using namespace std; int opcio1(); int opcio2(); int opcio3(); int main() { int choice; cout << "==========================================" << endl; cout << " Menu" << endl; cout … | |
Hi there! I'm having a homework problem, but it's with the header code I was provided in the text. When I try to use it, I get "name lookup of 'x' changed for new ANSI 'for' scoping using obsolete binding at 'x'" Did I do something wrong? Or is there … | |
can anyone help me on how to make this program short? what this program does is that its Initially on : R=1x1 off to the right, L=1x1 off to the left, G= night rider one cycle, S= off. This kind of program is made to control a micro controller...i need … | |
Hope someone can help. I'm self-studying from C++ Primer Plus, 5th Edition. I'm having trouble working out why the following two files will not compile. I'm using Dev-C++, under Windows Vista. [code="cpp"] /* Name: bankaccount.h Copyright: Author: Steven Taylor Date: 28/01/08 14:04 Description: C++ Primer Plus, Chapter 10, Programming Exercise. … | |
i hava a data student id examcode 1 002 006 001 2 123 589 How to store data when it have two data in 1 foleslike above? in .txt ot .cpp? and how can c++ called the data? | |
Hello, I'm trying to write a conditional IF statement for my program. What it's supposed to do is allow the user to enter numbers at random, but it cannot repeat any numbers. [ICODE]#include <iostream> using namespace std; void main() { int a; int b; int c; int d; int e; … | |
Ok so Im onto my next step.. Ive used c++ to read in an entire file, and got what I needed. The last and final step is to send the information in an email via my already setup outlook account. The below code works, and I dont know jack about … | |
Ok here is what I am trying to do at work as it's slower than a turtle in a race right now. I have a log of text guessing about 40 lines total. the last three sentences are what I am after .. being 38,39,40. I need to be able … | |
Hello everyone, im new here and a very noob programmer..I dont have mastery of programming and i find it very hard even the simple ones. Anyway, i need help in this program. Our professor asked us to program a simulation of soccer robots. What we are about to do is … | |
I am not sure if I am doing this assignment correctly, here is what it asks and the code that I have. I am not sure how to do the main to meet the assignments requirements. Any suggestions/advice are appreciated. > a. Create a function template called average(). It will … | |
I am tring to set an array with its values to zero within a constructor, but I can't get it to work. I have created an array with the size of 5 in the private of my class. I want the values of my array to be set at zero. … | |
Hi, I need some help with an assignment. Got some problems with my while loop. Can't seem to figure out what's wrong with it. [code=cpp] #include <iostream> #include <string> #include <bitset> using namespace std; int last (int num) { int l; l = (num % 10); return (l); } int … | |
Hi, i have been trying to do the following problem for homework, ialthough i have been able to input some code using the psuedocode given to me im am completely stuck now, and i was wondering if anyone could show me what i am missing? Question Use a single-subscripted array … | |
Hehe. I tried googling this, but all I've come up was Visual C++ results. How would I go about reading from a VERY VERY basic ini file in console C++ Using DevC++? The only things in the ini file are: b=65.0 c=1.5 k=1.65 I'm linking to this ini so that … | |
I'm trying to devise some base classes for a large system So why doesn't this work? [CODE=cpp] #include <iostream> using std::cout; using std::endl; #undef GetObject class IObject { public: IObject() { References = 0; } unsigned int GetRefCount() { return References; } private: protected: unsigned int References; friend class CHandle; … | |
We are being introduced to ADT's with type LIST. I initially thought LIST was included in some C++ library with predefined functions such as .insert(), .retrieve(), .getLength(), isEmpty() and so on. I now suspect this is all created by the programmer with classes and header files........which we'll cover shortly. Confused … | |
ok, i have a question say i have a class that wraps all file accesing functions ( basicly opening, reading and closing ) all these file handling functions throw a FileException exception i have a try block in that i open, read and close my file using the above mentioned … | |
Good evening ladies and gents, Had a question concerning this piece of code that I'm trying out from a book, it supposed to open a file, write text to it, close it, reopen it, append text to it and then write the text from the file to the console screen, … | |
Here is my code: [CODE]int LoadVerts(char *s_fName, OURCUSTOMVERTEX *p_Verts, short *p_Indices) { long i_CountVerts; long i_CountInds; unsigned char buffer[sizeof(OURCUSTOMVERTEX)]; basic_ifstream<unsigned char> f_DataFile; f_DataFile.open(s_fName, std::ios_base::in | std::ios_base::binary); f_DataFile.read(buffer, sizeof(long)); memcpy(&i_CountVerts, buffer, sizeof(long)); f_DataFile.read(buffer, sizeof(long)); memcpy(&i_CountInds, buffer, sizeof(long)); if ((p_Verts = (OURCUSTOMVERTEX *)realloc(p_Verts, sizeof(OURCUSTOMVERTEX) * i_CountVerts)) == NULL) exit( 1 ); if … | |
Hi to all. I need help. Quick and easy question. Is it possible to randomize and than delate stream of character pairs(one by one) from the input file? How can I do that? The input is a stream of character pairs that represent playing cards. For example: 2C, 3H, JH... … | |
Can anyone tell, how can i write that program in C++, its little bit Object oriented programming related... but i really need to develop logic in C++ Here is the statement: Write three classes names: circle, square and triangle, derived from class shape. Write down a function named intersect in … | |
[CODE]#pragma once class Account { public: //default constructors Account(); //constructor Account(double newSavingsBalance); //Methods //double MonthlyInterestRate(); //double newBalance(); void getMonthlyInterestRate(); static double AnnualInterestRate(); static void ModifyInterestRate(double newAnnualInterestRate); void setSavingsBalance(double newSavingsBalance); double getSavingsBalance(); double getAnnualInterestRate(); public: ~Account(void); private: double SavingsBalance; //static double AnnualInterestRate; };[/CODE] [CODE] #include "StdAfx.h" #include "Account.h" Account::Account(void) { } … | |
How do I write a C++ program that takes a string containg a full name, and outputs each part of the name seperately? const string fullname= "Horatio thadeous Hornblow" using only simple codes like length, size, adding, and subtracting. | |
I want some functions of one class in another class how can i acess that functions | |
Hello, I am trying to create a program that will read the point-slope information for two lines and determine if they intersect or are parallel. Below is the code I have: [CODE=c++]/*Point_Slope.ccp Reads the point and slope information for two lines and * determines whether they intersect or are parallel. … | |
hi, I am trying delete an old txt file and rename the new modified txt file... i followed everything from the example. However, i can't successfully rename the file. deletion is ok though. thank you. [code=cpp] void save(Name inName[], int j) { ofstream writer; writer.open("save.txt"); for(int x=0; x<j; x++) { … | |
im trying to make a counter to count the number of odd numbers in an integer entered by a user but somehow my loop doesnt seem to go on as i hoped it would...im trying practise using the while loop that some of u guys demonstrated on my other thread... … | |
hi, My program created an object array containing 271 objects from the "names.txt", and each object has 3 private class variables, "id lastname and firstname "...... i know i can't use ofstream writer to write it to a new file like.... Name name; writer<<name[270]; Anyone please help me understanding how … | |
Never mind. That question was solved by myself. anyhow, when I compile my code, I get an error. [CODE] #include <iostream> #include <windows.h> using namespace std; int main(){ for (int number=1; number<=6; number++;){ if (number == 1){ numbersuffix = "st";} else if (number == 2){ numbersuffix = "nd";} else if … | |
hi, thank you for replying. i started a new thread because nobody took a look at the old one. i finally figured out a way to add two arrays and using eArray. i also wrote the fibonacci code. However, when i debug and print the fibonacci number, i get some … | |
[code=cpp]#include <iostream> #include <iomanip> using namespace std; const float originalPrice = 50; const float markedupRate = 10; const float cTaxRate = 4; int main() { cout << "Enter the original price: "; float originalPrice; cin >> originalPrice; cout << "Enter the marked up rate(percent) : "; float markedupRate; cin >> … | |
See i have a program in c or c++.. this program has many functions like add(), mul(), div(), sub() etc.... now i want to call a function such that in main there should be only one call for that particular funtion that i have to be called... ie in runtime … | |
Hello! I'm a web developer and have not ventured outside of the AJAX threads. However, we're trying to take on a desktop application project here at work, and I'm wondering what language to specify it to be built in. We have programmers in C++ and Java (as well as C). … | |
Hi, I need to bubble sort a list of integers(unknown size). Unfortunatly I cant use the sort() method. Have tried transfering the contents to an array and sorting that but to no avail. If Anybody feels like hitting mewith some ideas would be great. Thanks! | |
Hi, i am getting frustrated with my code. please, please, please help me. i wrote a class eArray with different functions and i have all of them working but 2. for the first i am trying to get the nth fibonacci number. the second one, i am trying to add … |
The End.