581 Posted Topics

Member Avatar for azwraith69
Member Avatar for winrawr

Well the = operator is actually pointing the var[x][y] to the variable inp I think that you should replace the = operator with [code=cplusplus] for(int a=0;a<=len;a++) var[x][y][a]=inp[a]; [/code] I guess that would make it work as we are asigning the created array with a characters.

Member Avatar for Sky Diploma
0
301
Member Avatar for guest7

[QUOTE=Freaky_Chris;802669]The other option would be to close the file stream and then re-open, btw be sure to check that you actually need to read the file stream twice, rather than loading it contence into some data structure then reading that again. Just pointing that out because file access is slow …

Member Avatar for guest7
0
2K
Member Avatar for Jayrrus

Well post in your code again. And secondly. I dont see the variable "info" initialized in the code. Just check that out.

Member Avatar for ArkM
0
136
Member Avatar for CPPRULZ

Well I dont think it would work out. Basically constructors should be members of that particular class or if you design it explicitly it will become a function with the same name of the class and will produce out an error. If you wish to make the above methods work …

Member Avatar for CPPRULZ
0
168
Member Avatar for ohara

Well if the total content is in a string or in a file i guess it wont be much trouble reading them in. For the user. You can just search for a space in the string ' ' and then consider the next word as the user. And for the …

Member Avatar for ohara
0
111
Member Avatar for drjay1627

Well if you have idea about math, You can write the implementation itself by using the angles and the functions "sin , cos , tan etc. " Provided in the c++ math library. And if you wish to get yourself a algorithm i suggest you try googling it up.

Member Avatar for StuXYZ
0
113
Member Avatar for makimbo

Well i guess now you could use another variable to count how many times a particular number is repeated in the data set and then could get the percentage of the occurence of that particular number . You should however post your tries on doing this and we can help …

Member Avatar for StuXYZ
0
111
Member Avatar for k88joshi

Well i guess you can read each line of the file with getline functions and then search for each of your words inside the string. If it is found. you can use the erase function to remove that particular part of the string and then you can now insert your …

Member Avatar for k88joshi
0
363
Member Avatar for djzmo

Well What exactly does Spiral mean? Secondly could you just illustrate what is the desired output your code like you did with the mspaint example.

Member Avatar for Sky Diploma
0
117
Member Avatar for xmoon2000@gmail

[code=c++] std::clock_t start; std::clock_t end; double diff; int i; int a = 2; int b= 3; bool ba = true; bool bb = false; double da = 2.0; double db = 3.0; double cc; string input = ""; printf("Start\n"); start = std::clock(); for (i=0;i<4000000000;i++) { if (da==db) //CHANEGS MADE HERE …

Member Avatar for StuXYZ
0
185
Member Avatar for serkan sendur

[code] test::test() { struct deneme denemeler[5] = {{1,2},{3,4},{5,6},{7,8},{9,10}}; } [/code] I think that the above function is defining a new denemeler of deneme type and then as the constructor ends it gets destroyed. Hence you loose those values. After that your actual denemeler member doesnt contain any value. So hence …

Member Avatar for Narue
0
162
Member Avatar for greenbluekidz

[QUOTE=Freaky_Chris;790163]all of the lines to your if statement should be wrapped in {}. Also using cin>> is a step backwards from getline() you should read the stick "How do I clear the imput buffer?" Chris[/QUOTE] Along with the above you should also try to separate your code with functions. And …

Member Avatar for greenbluekidz
0
139
Member Avatar for Liszt

Well thats quite simple. You should try reversing the string also. However for the above encryption Take in the string. Then you should initialise another string Take a char from the first string and then store it into the second one. Then add your '0' To the string and again …

Member Avatar for Liszt
0
113
Member Avatar for yuanza

Secondly. If the day calculator function works. You can use the same thing to return yesterday and tommorow by using daycalculator with the inputs of (1 and ,-1) right

Member Avatar for yuanza
0
127
Member Avatar for Faterin

Well i personally didnt understand the char * cast that you put in the write. I would recommend that you should write in a << operator for your class . Such that it sends in the data as it is required. [code] int Student::operator << (&ofstream out) { out<<FullName<<CompleteAddress<<Gender<<Age<<LivesInASingleParentHome<<endl; } …

Member Avatar for damani88
0
257
Member Avatar for majesticmanish

Well i think that you should use getline(); and then get the input onto a stringstream or a string and then follow onto the next thing. with the string or stringstream itself. Other than that i dont know a way of finding the end of the line. Because i am …

Member Avatar for majesticmanish
0
170
Member Avatar for neoseeker191

[QUOTE=Murtan;782124]Add some debug... Does [icode]list[cnt] = (int)inputVal.c_str();[/icode] get you the numeric value you entered, or the address of the string?[/QUOTE] Well i dont think the int cast would do the trick. You can do two things for this 1 [code] list[cnt]=atoi(inputVal.c_str(); [/code] or 2 [code] istringstream s(inputVal); s>>list[cnt]; [/code] I …

Member Avatar for neoseeker191
0
245
Member Avatar for 72246

Well i think that you should post your code until where you have worked on.

Member Avatar for StuXYZ
0
254
Member Avatar for d0ne

Well for the starting day. i guess you can do this. First find this [code] int a = daysinwholeyearssince1800%7 [/code] According to this site [url]http://www.timeanddate.com/calendar/?year=1800[/url] First january 1800 was a Wednesday .. So if [code] string days[]={sun,mon,tue,wed,thurs,fri,sat}; //Then you can get the starting day with this int s =3+a; //the …

Member Avatar for Sky Diploma
0
88
Member Avatar for michael1201

And as far as testing is concerned. Each row and column should have a the numbers 1 to 9 in them and they should not repeat. So i guess You can do something like this. [code] for (int j=0;j<9;j++) { int total=0; for (int 1=0;1<9;i++) { total+=sudoku[j][i] } if(total!=45) { …

Member Avatar for mynameisor
0
270
Member Avatar for JustLearning

I dont get it, Your template destructor doesnt have anything to delete when the size of the class is 0, So i guess you should just implement to apply to an empty stack too. if *pointer==null;//maybe;

Member Avatar for gangsta1903
0
156
Member Avatar for nirav0190

Dude show us the code that you have worked on so that we can help. We donot do others homework.

Member Avatar for vmanes
0
92
Member Avatar for dmanw100

Well i dont think arrays can be initialised with variables. i think vectors are the suitable task for the job.

Member Avatar for dmanw100
0
243
Member Avatar for ardila

Seems to be a big post!!! Man, I guess you just have copy, pasted all the questions from your assignment. I reccomend that you read this post. [url]http://www.daniweb.com/forums/announcement8-2.html[/url]

Member Avatar for Freaky_Chris
0
180
Member Avatar for chococrack
Member Avatar for Alex Edwards
0
188
Member Avatar for panpanf

[url]http://www.eternallyconfuzzled.com/tuts/languages/jsw_tut_pointers.aspx[/url] Here is another llink that would help.

Member Avatar for grumpier
0
136
Member Avatar for sohamghosh

Well You should use files to store data and get back data in the beggining stages. filestreams would help you out with that. Try googling out filestreams with c++ for a tutorial.

Member Avatar for sidatra79
0
142
Member Avatar for koman

Well in your source code, what does i=q,u mean? it isnt a valid statement. You can try doing this. [code=cplusplus] #include <iostream> using namespace std; int main() { int q; int sum = 0; int num; cout << " Please enter a positive even interger "; cin >> num; if …

Member Avatar for Salem
1
111
Member Avatar for tatainti55

You can keep a new variable for every item. Namely price. int price =10; and a function like [code] void buy() { if(money<price) { cout<<"Not Enough Money"; else { //Code to add in another .... goes in here } } [/code] This is an example You should try to get …

Member Avatar for tatainti55
0
174
Member Avatar for rkumaram

Subscription operator can be overloaded. it involves using New and a destructor I think.

Member Avatar for ArkM
0
150
Member Avatar for joed13k1941

Well Its very easy, If you know how switch statements work. [code] char x; cin>>x; switch (x) { case: 'a' cout<<"x==a"; break; case: 'b' cout<<"x==b"; break; default: cout<<"no match found"; break; [/code] This is a small example of how you can use switch statements hope it helps.

Member Avatar for joed13k1941
0
118
Member Avatar for chunalt787
Member Avatar for chunalt787
0
266
Member Avatar for scottlpool2003

Well does this really convert the char to string? [code] int convert(char time[5]) { int time_mins; int int_time[4]; int_time[0]=time[0] - '0'; int_time[1]=time[1] - '0'; int_time[2]=time[2] - '0'; int_time[3]=time[3] - '0'; time_mins = int_time[0] * 1000 + int_time[1] * 100 + int_time[2] * 10 + int_time[3]; return time_mins; } [/code] You …

Member Avatar for emotionalone
0
123
Member Avatar for vrga

Well I see that you will need to delete all the members until you are left with one. So you will need to do this. [code] #include <iostream> #include <list> using namespace std; int main() { int n;//number of soldiers int k;//number skipped between cout << "Welcome to The Josephus …

Member Avatar for Sky Diploma
0
126
Member Avatar for joed13k1941

We would like it if you could post in your attempt and then we will sort it out to show your mistakes.

Member Avatar for Sci@phy
0
86
Member Avatar for FtKShadow

I think your game should run until the user runs out of money!! So You should be having 2 while loops. [code=cplusplus] while((bank!=0)&&(play=='y')) { noofGuesses=0; random = genRandom(); while ((noOfGuesses < 10)) { cin >> guess; noOfGuesses++; c = checkGuess (guess); if (c == 0) { total = bank + …

Member Avatar for Sky Diploma
0
136
Member Avatar for defychaos

Well this is nothing but an arithematic progression. Well the first element is 3 and the second element is ((3x1)+0)=3 again the next element is ((3x2)+1)=7 and so on. So you will just need to take in the first element as a ; Then to get the first element multiply....... …

Member Avatar for Lerner
0
342
Member Avatar for Sky Diploma

Hello Everyone, I have my Windows Xp operating system with perntium 4 in my Pc with 20 gb hardisk installed. So i divided the space into 2 partitions , C: with 8 GB and D with 11 GB and the other was just unformatted. It was running Fine. But suddenly …

Member Avatar for c-tech
0
103
Member Avatar for demroth

Hey I donot understand Why you actually need the second loop. I prefer to do this 1)initialise all elements of your subarrays to '0' 2)Remove the second for loop 3)After finding the limit in which the value can be assigned in , Search for a zero in the sub array …

Member Avatar for demroth
0
92
Member Avatar for sunveer

>Please Provide The Simplest Code. Well wont it be simple If You create a function to interchange the first and last char and then the last but one and second character and so on.... This should be done until They Come to the middle of the word. Try Implementing a …

Member Avatar for Narue
0
169
Member Avatar for acoxia

Well i dont get it , You are given two Binomails as input and then you are required to split them .. This is very simple. I GUESS you could just search for "(" start and ")" and give out the value in between as a factor. Unless You have …

Member Avatar for acoxia
0
151
Member Avatar for NinjaLink

[code] void Prt_Gradebook (string names[], int score[][3]) { for (int i = 0; i < 5; i++) { cout<<names[i]<<" "; int sum = 0;//Changed It to Here. for (int j = 0; j < 3; j++) { cout<<score[i][j]<<" "; sum+=score[i][j]; } cout<<sum/3; cout<<endl; } } [/code] How about this ? …

Member Avatar for NinjaLink
0
109
Member Avatar for JackDurden

[QUOTE=JackDurden;707731]neither of your answers worked[/QUOTE] No they seem to work out fine. Its just that the template node should be declared before template snake does. Just by doing that. the second example works. [code=cplusplus] #include <iostream> #include <stddef.h> using namespace std; template<class T> struct node { T data; node *next; …

Member Avatar for Sci@phy
0
88
Member Avatar for hapiscrap

Hey, Are you sure that the file is being opened? Because Your Code Doesnt Test whether it has opened it [code] if (myfile.is_open()) { /* ok, proceed with output */ } [/code] You should have an if statement like the above to know that you have opened the file successfully.

Member Avatar for Sky Diploma
0
217
Member Avatar for sleepytoast
Member Avatar for sleepytoast
0
102
Member Avatar for jeevsmyd

I think you should understand exactly on how these functions are called and executed and choose a spot Yourself. And as far as the time limit is considered. You should multithread the program , I dont see anything else capable to do so.

Member Avatar for Ancient Dragon
0
124
Member Avatar for Geard2

[url]http://www.daniweb.com/forums/thread70096.html[/url] There are a list of good books. Feel free to purchase and study..

Member Avatar for Sky Diploma
0
90
Member Avatar for Gary_nel

[url]http://www.daniweb.com/forums/thread42722.html[/url] I think this should help you a bit . After finding all the files You can just copy and paste those files into a different directory.

Member Avatar for Ancient Dragon
0
146
Member Avatar for Sky Diploma

[code=cplusplus] string countx(string sky) { int count=0; for(int x=0;x<=sky.size();x++) { if(sky[x]=='x') { sky.erase(x); ++count; } } stringstream ins; string bang; // Declare an input string stream. cout<<"count " <<count; ins << count; bang = ins.str(); sky=sky+"x^"+ bang; cout<<"Sky == "<<sky<<"\n"; return sky; } [/code] Writing a function that will take …

Member Avatar for Sky Diploma
0
99

The End.