49,761 Topics

Member Avatar for
Member Avatar for Sheepdawg

Bored and just wrote this. Anything I did wrong? Anything that can be improved? Relatively new to C++ but I have the basic basics down(I like to think so anyway). [CODE]#include <iostream> #include <cstdlib> #include <ctime> using namespace std; void programIntroduction(); void gameLoop(); int playerChoice, cpuChoice, wins=0, losses=0, ties=0; int …

Member Avatar for Lerner
0
243
Member Avatar for rucafe

I have created two classes: [code]class dm_Step { public: char m_plus; char m_particle; float m_energy_sec; float m_xpos_sec; float m_ypos_sec; float m_zpos_sec; }; [/code] [code]class dm_Track { public: vector<dm_Step> m_track; } [/code] I have a data base with hundreds of lines of code in the following format: + gamma 2.306013 -0.213225 …

Member Avatar for gerard4143
0
193
Member Avatar for mrmodest34

Hey, I am having trouble implementing a c++ function that will allow the user to enter a lower and upper bounds and reverse everything in a char[] in between the bounds, so if array is, char[] = {'A','B','C','D','E'}; and the user input was 1 and 4 for 1 as the …

Member Avatar for Lerner
0
194
Member Avatar for MrEARTHSHAcKER

Hi, I noticed many programmers accuse C++ as very hard language for GUI and very good language for the code. Is there any way to integrate 2 languages, C++ and any other language which is easy to make GUI with? Thanks.

Member Avatar for mike_2000_17
0
273
Member Avatar for KRUX17

The code below takes the quantity of tickets from the 55 tickets that is available and it stores the value in a text file. What I want the program to do is to store the amount of tickets that is available and then each time the program executes it will …

Member Avatar for KRUX17
0
105
Member Avatar for caltech

Here's the full assignment: [QUOTE]The ABC Corporation wishes to review a group of its products based on their performance in the prior fiscal year. The company has the sales data for these products for each quarter in the year. Having heard of your programming experience, the company has hired you …

Member Avatar for caltech
0
139
Member Avatar for KRUX17

Hi, I was wondering is there a way where you can sell limited tickets. For example there are 55 seats in a bus and 55 people bought the tickets for the bus,the people who want to buy those tickets for the bus must wait for an hour. How would I …

Member Avatar for KRUX17
0
245
Member Avatar for timkunce

I am only allowed to use int, unsigned int and float. Must be accurate to the 7th significant digit. Currently I overflow 'float top' at an x value greater than 13. Thank you for your time. [CODE] #include <iostream> #include <iomanip> using namespace std; float sum=1,x, top=1,factoral=1; int main(void) { …

Member Avatar for Se7Olutionyg
0
4K
Member Avatar for shahinkey

Dear all, I have problem with reading from ini file. My code is as follows, but it has Error with GetPrivateProfileInt. It cannot read and the error is : error C2664: 'GetPrivateProfileIntW' : cannot convert parameter 1 from 'const char [9]' to 'LPCWSTR' 1> Types pointed to are unrelated; conversion …

Member Avatar for AritraP
0
284
Member Avatar for torrm

Hello all. A friend is shipping some items in a container so it gave me the inspiration to write a quick little program. This only took 20minutes at best so please bear that in mind. The basic idea is if the containers size is known, and the cost is known …

Member Avatar for Labdabeta
0
425
Member Avatar for vlaskiz

Currently working with graphical interface and dynamic object arrays, Got two text files with kinda same data on it, my current task is just to read and output that data. Problem is most likely either with my read function or function to determine how much data there is in files …

Member Avatar for vlaskiz
0
609
Member Avatar for alenD

Hi all, I am doing something like this int f(){ umap::iterator p = mmap.find(s); if(p != mmap.end()){ ....... } } My memory usage is somehow constantly increasing. While exiting the function do I need explicitly delete the iterator p? Thanks in advance, _alen

Member Avatar for MastAvalons
0
584
Member Avatar for faraz ahmad

Aoa, Hello All, i am having problem in this question Write a program that takes integer input from the user and store into the array dynamically allocated each time a new element is added. Your program should prompt user to take integers until he enters -1, which means end of …

Member Avatar for MastAvalons
0
342
Member Avatar for capton
Member Avatar for DeanMSands3
0
407
Member Avatar for tom12

#include <iostream> #include <string.h> using namespace std; int main() { char clear[200]; char cipher[200]; int x,i; cout<<" Enter a string:"; cin.getline(clear,sizeof(clear)); x = strlen(clear); for(i=0;i<=x-1;i++) { cipher[i] = clear[i]+3; } cipher[x] = '\0'; cout<<" Encrypted:" << cipher << endl; system("pause"); return 0; } Hey guys hope someone could help me, …

Member Avatar for tom12
0
192
Member Avatar for learner guy

I want to find if Array B is present in array A(B is a substring of A).. i have written this small function but its not working as desired ..can anybody plz help and point out where i m wrong [CODE] bool substring(char A[],char B[]) { int aSize=strlen(A); int bSize=strlen(B); …

Member Avatar for Ali_2101
0
346
Member Avatar for mweshk

Dear Gurus, I am having this inventory program but can not give me the desired results.What am I doing wrongly? I want a user to enter and display results. [CODE] #include <iostream> #include <fstream> #include <iomanip> #include <cctype> using namespace std; const int DESC_SIZE = 51; // holds inventory description …

Member Avatar for Ali_2101
0
687
Member Avatar for sharath_137

hi , I was trying to open a file using fopen() method. It's not opening all the time. some time it opens but the other time its getting crashed.... FILE* tmpfile = fopen(xxxxxx, "r") this is the code i am using.... and every time the value of xxxx is coming …

Member Avatar for Ancient Dragon
0
88
Member Avatar for navinrahim

Rewrite the following program after removing the syntactical error(s) if any. Underline each correction. [CODE]#include<iostream.h> #include<conio.h> class employee { int no; class data { int dd,mm,yy; public: void print_data() { cout<<dd<<mm<<yy; } }; data dob; public: data doj; void prin_t() { doj.print_data(); cout<<dob.dd<<dob.mm<<dob.yy; } }; void main() { employee 1emp; …

Member Avatar for deceptikon
0
144
Member Avatar for solarcoder

I was tried to debug to find an explanation to this but i still don't really understand the concept. Here goes. [CODE] //pass in value //973 456.2 77F //973 456.2 77F #include<iostream> using namespace std; int main() { char letter; int n; float m; cin>> m; cin.clear (); cin.ignore (200, …

Member Avatar for deceptikon
0
152
Member Avatar for ads1188

Hello All, I have starting using Visual Studio Pro 2010 and I understand the very basics in programming. Currently I am trying to create a login system where users enter their usernames and passwords. I have been experimenting with trying to link Access database to MySQL but im having no …

Member Avatar for ads1188
0
263
Member Avatar for prasenjit_das

hi all, I am trying to develop autocad like software in c and c++ .Which c and c++ editor is best to develop software..editor must be support graphics program in c and c++.. please give me suggestion ,link,and tutorial learn something

Member Avatar for Ancient Dragon
0
60
Member Avatar for tom12

#include <iostream> #include <string.h> using namespace std; int main() { char test[256]; int x,i; int vowels; cout<<"please enter a word"; gets(test); x = strlen(test); for(i=0;i<=x-1;i++) { if(test[i]!=' ') { cout<<test[i]<<endl; } if (test[i]=='a' || test[i]=='e' || test[i]=='i' || test[i]=='o' || test[i]=='u' || test[i]=='A' || test[i]=='E' || test[i]=='I' || test[i]=='O' || …

Member Avatar for Ancient Dragon
0
924
Member Avatar for prasenjit_das

hi all, I do not understand how i concatination of two string using pointer in c++. please can you give sugestion how i implement.. thanks in advance

Member Avatar for L7Sqr
0
160
Member Avatar for tastybrownies

Hey everyone, I am pretty new to writing procedures that deal with this idea of recursion. I am trying to get into that certain frame of mind but I am having a little bit of trouble at the last minute. My goal was to implement a text operation called swap …

Member Avatar for jmichae3
0
226
Member Avatar for jmichae3

I am going to assume that gcc is the compiler people are using on their *NIX. so for that, I know that [CODE]#if defined(__GNUC__) [/CODE] will work. SO... for Centos, Solaris, HPUX, AIX, Linux, BSD, FreeBSD, OpenSUSE, Fedora, redhat, what #if defined()'s do I use to detect these OS's?

Member Avatar for L7Sqr
0
114
Member Avatar for SamuraiGhost

I believe that my program in the attached file is almost finished. When I try to run the program,there are two error message that pop up. The error are the following: 1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 1>c:\users\usr\documents\visual studio 2010\Projects\NEWLDIST\Debug\NEWLDIST.exe : fatal error LNK1120: …

Member Avatar for DJSAN10
0
235
Member Avatar for nahmartin

Hi, I am having trouble outputting to many files [CODE] ifstream sim_dump; sim_dump.open("c_grain.sim_trj"); char dump_file[20]; int itr = 4000; sprintf( dump_file, "%d", itr); ofstream fout(dump_file); while(lammpsdump.good()) { //if(itr % 100 == 0) //{ fout.close(); sprintf( dump_file, "%d", itr); ofstream fout(dump_file); cout << "TIMESTEP " << itr << endl; //} ... …

Member Avatar for nahmartin
0
160
Member Avatar for ruval002

ok so first of all my following code its suppose to read input from user and seperate the strings into commands and arguments.For example if i input changeDir hello , the tokenizer(which i already implemented) will split it and put changeDir into tokens[0] and hello into tokens[1]. Now what im …

Member Avatar for ruval002
0
160
Member Avatar for scottd82

Hey everyone, I wrote some code to create a deck of cards, described the deck and randomly deals 5 cards. First, I want to let everyone know that this is homework for my C-II college class, so I am not looking for any answers, but solutions or guidance in figuring …

Member Avatar for WaltP
0
1K

The End.