104 Posted Topics

Member Avatar for jojodeco
Member Avatar for Lerner
0
177
Member Avatar for akash.doe

I'm not sure about this one, maybe you could have a pointer to some dynamically allocated memory?

Member Avatar for thines01
0
85
Member Avatar for artan8

>Question 5 What is the meaning of the word 'const', and give one good reason why it is good to declare a const variable for the size of an array? The word **"const"** is short for constant, and really all this does is ask the compiler to keep an eye …

Member Avatar for MandrewP
0
295
Member Avatar for bleedi

[QUOTE=bleedi;1782916]Hey guys! I've got a small problem that I can't figure out. I have 2D arrays of arbitrary sizes, and they contain different characters representing different stuff (like 'a', 'b', 'c' etc.). Now, the problem is, I need to find horizontal and vertical lines of same characters and make new …

Member Avatar for bleedi
0
377
Member Avatar for hey.howdy

[QUOTE=hey.howdy;1783025][CODE] #include<iostream> using namespace std; void comparison(char arr2[], char arr3[],int& i,int j) { int abc=1; for(j=0;j<5;j++) { if((arr2[j]==arr3[j])||(arr2[0]!=arr3[0])) { j++; } i=i+1; j=5; } } int main() { char arr[5]={'a','b','c','d','e'}; char arr1[5]={'a','b','c','d','e'}; int refr=0, iteratorr=0; comparison(arr,arr1,refr,iteratorr); for(iteratorr=0;(iteratorr<5&&refr==1) ;iteratorr++) { cout<<arr1[iteratorr]<<endl; } return 0; } [/CODE] //Can anyone help me figure …

Member Avatar for hey.howdy
0
155
Member Avatar for a_sd

Print out the first number and also store it in an array. Get the second number and compare it to the array, and if not found in the array, store in array and print out, else don't print out. Loop around and do again for each additional number.

Member Avatar for WaltP
0
139
Member Avatar for Raisefamous

[QUOTE=Raisefamous;1782953]Hi, I need to sort a string of symbols and numbers in to two different strings, first one with numbers, second with symbols. I have written the following code, but it only passes the first type into its string and gives random characters for the second type. Example: if i …

Member Avatar for Raisefamous
0
109
Member Avatar for salem13

There are two things going on here - sorting the input in ascending order, and then counting the number of integers in a line. So first off, you need a sorting algorithm to sort each line in ascending order. There are various sorting algorithms that you could use which you …

Member Avatar for salem13
0
135
Member Avatar for while(!success)

[QUOTE=while(!success);1780916]Hey guys, learning about multi-dimensional arrays and am tracing a code that my teacher gave us, but I'm failing to see or conceptualize it. for instance: Why does the following code output 3? [CODE] int a[2][4][2] = {16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1}; cout << a[1][2][1] << endl; //output is 3 [/CODE] How are the …

Member Avatar for while(!success)
0
300
Member Avatar for MandrewP

It would be nice if you could improve the formatting when a message is being posted. What you post in the message box (editor) does not always come out on the board the same way. For example, if I include many spaces, like this: Hello how are you? then the …

Member Avatar for Nick Evan
0
108
Member Avatar for PrimePackster

[QUOTE=Captain Jake;1778097]Problem came up after reinstalling.. Well deleting the setting folder didn't help......[/QUOTE] Click on [B]"Debug[/B]" and then choose "[B]Options and Settings[/B]". Then click on "[B]Text Editor[/B]" then on [B]C/C++[/B] then click on "[B]Advanced[/B]" and then in the window on the right scroll down to [B]IntelliSense[/B] and make sure "[B]Disable …

Member Avatar for Ancient Dragon
0
182
Member Avatar for dlmagers
Member Avatar for BillyD282

On line 86, the parameter list doesn't match the parameter list of the prototype.

Member Avatar for MandrewP
0
440
Member Avatar for triumphost

Just think of the postfix operator (x++) this way: After everything is done and calculated on that line, [I][B]then[/B][/I] that variable is incremented just before leaving that line of code. For the prefix operator (++x), the variable x is incremented at the same moment that the compiler looks at it.

Member Avatar for mike_2000_17
0
319
Member Avatar for Labdabeta

Run length encoding is simple, but it may not be suitable for your type of data. But it may work if you can deal with your data as a continuous string of ones and zeros and then compress the ones and zeros. After you uncompress the continuous string of ones …

Member Avatar for Labdabeta
0
251
Member Avatar for radiat

[QUOTE=radiat;1759946]Hi, can you have a quick look at the two for loops here. I've declared the int 'i' in the first for loop but in the second for loop it doesn't recognise it and i have to declare it again. Why is that? [CODE]for(int i=0; i<x; i++) { cout << …

Member Avatar for MandrewP
0
180
Member Avatar for Jay22

[QUOTE=Jay22;1757980]ok so basically my code is complete but I keep getting an error on one of my brackets and it says I need to put a ' ; ' behind "int LinearSearchArray ( const int list[], int numEless, int value)" and when I do that it brings up more errors. …

Member Avatar for MandrewP
0
169
Member Avatar for Reclaimer0418

Here is how you use an if statement: [CODE]if(condition is true) { ...... ...... } else: do this; [/CODE] The else comes after the program statement(s), but you are making it a part of the program statements. It's OK to do this: [CODE]if(condition true) { if(condition true) { ...... } …

Member Avatar for MandrewP
0
776
Member Avatar for rfrapp

[QUOTE=rfrapp;1746974]When I add this into the for loop in my "convertToDec" function, I get a runtime failure unless there are 0's before the number.[/QUOTE] Well, I guess you have already handed in your homework since it is the end of Jan 31 so I guess I can spill some more …

Member Avatar for rfrapp
0
3K
Member Avatar for sumanth232

[QUOTE=sumanth232;1752577]what is an lvalue. and whats the wrong in my code in line 6? very curious to know about it. thank you[/QUOTE][CODE]#include<stdio.h> int ways(int n,int m) { if(n=0) return m; if(m=0) return n; else ways(n,m)=ways(n-1,m)+ways(n,m-1); //there is an error here.pls explain// return ways(n,m); } int main() { int a,b; printf("give …

Member Avatar for MandrewP
0
926
Member Avatar for chuyauchi

[QUOTE=chuyauchi;1752566]when I have 3000 times (1.0 / 36.0), the result is 83.3 How can I only have the result 83 without .3 ?[/QUOTE] You can cast any float or double value to type int and you will lose any fractional part. Of course you will want to make sure that …

Member Avatar for MandrewP
0
99
Member Avatar for inspire_all

[QUOTE=sukhi badhe;1751366][CODE]#include<iostream.h> #include<conio.h> struct marks { int a:3; int b:3; int c:2; }; int main() { clrscr(); marks m={2,12,5}; cout<<m.a<<m.b<<m.c; getch(); return(0); }[/CODE] o/p is 2-41 i got how 2 and 1 came but didnt get how -4 came. according to me it should have been binary for 12=1100 b …

Member Avatar for MandrewP
0
121
Member Avatar for LdaXy

[QUOTE=LdaXy;1719422]back again with another question. i created a simple window in WIN32 mode, but it's giving me a linker error that i cannot isolate. [CODE]#include <windows.h> #include <tchar.h> #include <stdio.h> //defined this for all processes HINSTANCE hInstance; LRESULT CALLBACK WinProc(HWND hWnd, UINT msg, LPARAM lParam, WPARAM wParam); //WndProc Prototype. always …

Member Avatar for zazacofi
0
237
Member Avatar for firebird102085

> I am just starting to teach myself C++ and i have no coding experience so please bear with me on this if I ask you to explain your reasoning behind your response. > > My code is: > > > > // operating with varables > #include <iostream> > …

Member Avatar for MandrewP
0
4K
Member Avatar for maverick01

>the uploaded is a assignment and i want to solve this task using the library fstream and using the tellp ,seekg other functions also can some body help me in that how to use all these things..!!I WROTE A FUNCTION ALSO BUT IT IS NOT READING THE FILE??? THE FUNCTION …

Member Avatar for MandrewP
0
236
Member Avatar for Torf

[QUOTE=Torf;1737094]Hello, I do not understand the following parts in bold - how it works, what is is for..etc. I'm not following the book's explanation.. [CODE]#include <iostream> using namespace std; [B] double totalCost(int numberParameter, double priceParameter);[/B] int main( ) { double price, bill; int number; cout << "Enter the number of …

Member Avatar for MandrewP
0
284
Member Avatar for gfp91
Member Avatar for MandrewP
0
132
Member Avatar for lolwaht
Member Avatar for mrnutty
0
97
Member Avatar for HASHMI007

[QUOTE=HASHMI007;1725716][CODE]// Sorting Techniques.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> using namespace std; void Bubble(int x[],int n ){ int main(){ int n=5; int a[5]={1,5,3,2,4}; for(int i=0;i<5;i++){ Bubble(a,n); } } [/CODE] there is problem , in main[/QUOTE]As was already mentioned, in main(), you are calling …

Member Avatar for HASHMI007
0
136
Member Avatar for gopal1993

If only life was so nice, but it doesn't work that way. You need to post how much code you have so far and then we will assist you from there. Be sure to put your code in code tags.

Member Avatar for tkud
0
88
Member Avatar for floatingDivs

[QUOTE=floatingDivs;1724478]Hey everyone (especially Narue!), I've ventured over to the C++ board again. I've been reading my C++ book (Data Structures and Algorithms in C++) again and want to fully grasp the concept of pointers. In the back of each chapter, a couple of exercises are available and I'm attempting to …

Member Avatar for floatingDivs
0
718
Member Avatar for Vasthor

[QUOTE=Vastor;1718593]in the 2nd code, the [B]int i[/B] is not defined in the main(), so, because of that, we can use multiple 'for loops' with same iterator([B]int i[/B])?[/quote] Yes you can, at least according to the C\C++ standard, but some compilers will allow the iterator to remain in scope even outside …

Member Avatar for Vasthor
0
247
Member Avatar for Tahmod

One easy way to do this is to use a bubble sort to sort the array in reverse order, then print out the array. A bubble sort is not very efficient, but it is easy and it will get the job done. Here is how a bubble sort works: Fill …

Member Avatar for Schol-R-LEA
-1
272
Member Avatar for Chuckleluck

I would think that "locale_facets.tcc" also uses two variables called a and b. Try changing a and b in Main.h to something else and see if that corrects the problem.

Member Avatar for Chuckleluck
0
434
Member Avatar for PrimePackster

[QUOTE=Captain Jake;1707153]Well the latter is not working, and the loop to print the ascii table is having the same trouble.[/QUOTE] The loop to print the ASCII table seems to be working fine (?). The only thing that doesn't work is choice 2 - converting a numerical value into a character …

Member Avatar for PrimePackster
0
250
Member Avatar for AlvinLiu

Regardless of what the author of this code intended, what it actually does is this: This function fo() prints out the value of count, and the value of count will be increased by 1 if it is less than 5 or else it will be increased by 2 if it …

Member Avatar for MandrewP
0
188
Member Avatar for anamoblu56

Here are some suggestions: You can call temp[ ][0] the low for that day and temp[ ][1] the high, and maybe you could do your input something like this: [CODE]#include "iostream" #include "iomanip" #include "cmath" #include "string" using namespace std; int main() { //declare array int temp[7][2]= {0}; int day …

Member Avatar for MandrewP
0
2K
Member Avatar for R3AL

I think you are accessing memory that you shouldn't be. Maybe there is a pointer out of bounds that wasn't initialized properly? Or maybe the stack hasn't been restored properly since you did push EBP. And in line 5, did you mean to mov EDI into itself? I would say …

Member Avatar for R3AL
0
147
Member Avatar for gameguy91

[CODE]#include<iostream> using namespace std; int main() { int n1,n2,n3,n4,n5; cout<<"input number1\n"; cin>>n1; cout<<"input number2\n"; cin>>n2; cout<<"input number3\n"; cin>>n3; cout<<"input number4\n"; cin>>n4; cout<<"input number5\n"; cin>>n5; //if (n1>n2 && n1>n3) if(n1 < n2) n1 = n2; if(n1 < n3) n1 = n3; if(n1 < etc....) etc.... cout << "\nThe largest number is …

Member Avatar for gameguy91
0
156
Member Avatar for bwilson1

[QUOTE=bwilson1;1709805]How would I overload the getInput()function?[/QUOTE] You overload a function by making different versions of it. All the versions have the same name, they just differ in the parameters. For example: [CODE]int getInput(a[], int); int getInput(int, int); int getInput(double, float);[/CODE] Then the compiler will automatically select the right version for …

Member Avatar for MandrewP
0
122
Member Avatar for Muhammad Anas

[QUOTE=Muhammad Anas;1697569]Hi, I am trying to write a program that will separate the digits....[/QUOTE] There is probably some nifty mathematical formula to do this with instead of the one you are using in your while loop. However, I'm not about to figure that one out! Why not just reverse the …

Member Avatar for Muhammad Anas
0
3K
Member Avatar for jlake
Member Avatar for AmerJamil

[QUOTE=AmerJamil;1695741]i am having problem in type casting,the result of the following code is giving -64, however it should be 192, why this is so?[/QUOTE] The problem is that a type char is signed by default. Since a type char is one byte (8 bits) then that means the highest order …

Member Avatar for MandrewP
0
244
Member Avatar for manchurianCEO

If the board is not under warranty, you might just want to replace the capacitors. Just read what voltage they are rated for and how many microfarads they are and what type of capacitor it is. Why pay hundreds of dollars for a new board when a dollar or two …

Member Avatar for manchurianCEO
0
212
Member Avatar for Aghtar

[QUOTE=Aghtar;1693583]Still cant make it work.. D:[/QUOTE] Apparently, you still can't make it work because you are lacking clarity on some things. So let's review a few things that I'm sure you've already covered but haven't learned very well (which is why you have these exercises!) I will give you a …

Member Avatar for MandrewP
0
1K
Member Avatar for learner guy

The text is blinking because the text attribute is set to blink. Hove you bothered to set up the text atrribute, or are you just accepting the default value? When the text attribute is set you are setting the forgraound color and the background color. I believe it is the …

Member Avatar for MandrewP
0
351
Member Avatar for C++isC++

OK, here is a little help to get you statrted. First of all, you need to put the problem into some kind of structure so that you can code it. Let's start with the input which consists of two pieces of data: the dollar amount and the time of investment. …

Member Avatar for MandrewP
0
103
Member Avatar for squall730

[QUOTE=squall730;1688167]I have a homework assignment where I'm supposed to use pass by references. I'm reading my text and don't really get it. [/QUOTE] I think part of the problem is that you aren't clear on how you pass ANYTHING to a function. I will show you why you need to …

Member Avatar for selina12
0
330
Member Avatar for C++newbie chick

You made changes? Like what? Did you take care of the variable "j" which was not initialised? I initialised it to zero and then the progam no longer crashed. The j variable was apparently causing memory to be accessed that was beyond bounds, causing an access violation. So if the …

Member Avatar for C++newbie chick
0
325
Member Avatar for C++newbie chick

After a breif look, I found that in line 154, if you change the variable "decision" to type char instead of type int, then the endless loop does not happen. Then you are able to change the course code, and the program aknowledges that the course code has been updated. …

Member Avatar for Ancient Dragon
0
318

The End.