51,593 Topics
![]() | |
im working on a program for my exams and its not really working.....cant really figure out why........i ran my program in both borland and turbo.....and both are giving the same error......DECLARATION SYNTAX ERROR. [CODE]void mul(int a[][3],int b[][3]) {int k=0; for (i=0;i<3;++i) { for(j=0;j<3;++j) { c[i][j]=0; for(k=0;k<3;++k) c[i][j]=c[i][j]+(a[i][k]*b[k][j]); //Multiplication of two … | |
Hi, With the piece of code: [CODE] 1 #include <stdio.h> 2 3 typedef struct { 4 int x; 5 int y; 6 } addr; 7 8 typedef struct addr a; 9 10 int main() { 11 addr array[5]; 12. printf("%d\n", sizeof(array)/sizeof(addr)); 13. return 0; 14. }[/CODE] Having this error: nettest.cpp:8: … | |
While using socket library of c++, I find the following pointer (servinfo) to the library function getaddrinfo. Now I need to know the array size of the pointer servinfo (allocated by the library function) so that I can access each element of the array. How can I get the size … | |
Please can anyone out there help me see the problem with this piece of code? I’ve tried running it on the visual studio compiler But either get warnings or undesired output. I supposed the code to be a little dictionary that compares Inputs with some set of predefined ones and … | |
I'm not quite sure how to fix it. I have done the debugger on it, and it seems that it might have something to do with the cin.get() but im not sure. [CODE]void MyFloat::Read() { char ch; int k = 0; cin.get(ch); while( ch == '0' || isspace(ch)) cin.get(ch); if … | |
I've been surfing the net for hours now looking for a good example of reading and sorting data from a textfile.:pretty: But I can't find a good one that is working. :(Can somebody give me a simple example code of reading and sorting data from a textfile in ascending order … | |
I am new to this website, and coding as well, so please bear with me. I have a program that i'm trying to fortmat the output into a single line. The output should read : HHHHHTTTTT Number of Heads: 5 Number of Tails : 5 where the values change per … | |
Hello. I really need help with adding graphics. I have skimmed through multiple tutorials, but all of them have been wicked long, and I honestly don't know how to execute them properly. So I was wondering if any of you had a [b]code snippet[/b] that would allow me to add … | |
I need to add sound to this code but I cannot figure it out! Help!! [CODE]#include <iostream> #include <cstring> #include <cctype> using namespace std; int main() { int i, j; int iL; char alph[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; char *morse[] = { ".-" , "-..." , "-.-." , "-.." , "." , … | |
I'm getting the same very large number for item and for each element in the array after that for loop is done. Why am i not pulling the 6 numbers from my input file? Thanks. [code=c] #include <iostream> #include <fstream> #include <iomanip> using namespace std; int main(int argc, char *argv[]) … | |
I have a quick question regarding precision printing output to cout. I need a way to print a MINIMUM number of decimal place digits to cout and also possibly have a maximum number of decimal places printed. Also, I need a way to "undo" if you will a call to … | |
I have the following driver for my template class the parameter being passed to the template is another class, the error I get is Error line 28 : templateclass.h std::ostream<<ballteam is illegal driver.cpp line 30 Where instationating templateclass<ballTeam>::print const () driver [code] #include <iostream> #include <fstream> #include "arrayListTypeT.h" #include "ballTeam.h" … | |
Student Problem: "I am trying to get the code below to compile which is from my textbook [I]"C++ How To Program (6th Edition)"[/I] Fig. 4.9. However, I keep getting the "Fatal Error LNK1561: Entry Point Must Be Defined" every time I try to build the code." What I Know So … | |
Hi, I am trying to use strings, and even a simple program like this doesn't work. [CODE]#include <iostream> #include <string> int main() { string Hello; Hello = "Hello world!"; cout << Hello; cin.get(); }[/CODE] I am using Borland C++ 5.0, and it gives me this error. "String does not name … | |
In my c++ book they give a program that finds the prime numbers between 1 and 100. The problem I am having trouble understanding is the logic of the second for loop. I know what it does but not how, if that makes any sense. [CODE] #include <iostream> using namespace … | |
Hi, I've been writing a program that encrypts and stores passwords (it's for uni, I'm a newbie), and I'm having a problem with some misbehaving variables. I hope someone can shed some light on it for me. :) I have a function which takes a string as a parameter and … | |
Hi, I'm looking for help writing a program to check an input file for errors in its pattern. Basically, I've got a file of thousands of lines like this: "70 20000731 210202 19 36005 354 55.369 -37.207 -54 0.847 491 0.981 0.985 278977" I have no trouble opening the file … | |
Hello, I've attached my code, I keep getting the Debug Assertion failed, Expression: string subscript out of range error I can't find any errors in my logic and code for the functions, but obviously something is wrong, no matter where I put breaks, i still get the error when debugging. … | |
hi all i need some help with time.h for in the following: i want to make a programme in which while time is 12:00 PM, It prints a Web-page USING time.h thx,,,, kim00000 | |
I have an assignment to write a program using 1D and 2D parallel arrays with input coming from a .data file given to us. I am nearly a complete novice with writing code and right now I am having a very hard time getting my program to write any values … | |
I AM HAVING A HARD TIME WITH STRINGS. I DO NOT FULLY UNDERSTAND IT. THIS IS FROM A BASIC INTRO C++ CLASS HW PLEASE HELP THIS IS THE QUESTION Write a program that uses cin to read a given name (like Louis) and a family name (like Armstrong) into two … | |
aslmolikum im new member here, hope u ppl ll welcum me warmly, i m student of MIT, im having problems in C++ so i want to learn from here, plz help me out,..... | |
I have a 10x10 matrix.basically this matrix is a square of 50 cm.and In this square we cut circles of diameter 5 cm each.The x and y co-ordinates are specified.I need to fill the martix depending on the circle it represents(with the help of given x and y co-ordinates). I … | |
Hi, I am Rahul. We have a complete software written out (with n other shared libraries maintained by various other teams). The shared libraries are loaded at run time by the main executable depending upon what feature user wants to run. All across our code, we are using printf and … | |
Hi I have a pointer generated in a method. And this pointer is input to another object. So at what point I have to delete this pointer? [CODE] method() { TEnemyCharacter *tenemyCharacter = new TEnemyCharacter(this); } [/CODE] So how to delete this tenemyCharacter. I cannot use delete tenemyCharacter; at the … | |
Ok, I have a given template class code the only thing we are to implement is inserting an item so that the template array list is still in ascending order my template passes the parameter of another class, this classes contains overloaded operators < > == based upon the win … | |
HI, Today im tying to build a game program,im not really stuck on the coding aspect but its the concept of the 2 players in the game that is confusing me. For a starters, the game has 2 players.Player one goes first,after their go its player twos turn and so … | |
i want a code to store a decimal number as a string i'm working on a progeam to convert a binarry number which entered as a string from user to decimal number stored as string. i have done the converting from binary number to decimal integer but i couldn't store … | |
I have a dynamic array and i am trying to create a iterator class to support the list. I am adding begin and end. As well as a new class. error C2146: syntax error : missing ';' before identifier 'begin' Error 7 error C2146: syntax error : missing ';' before … | |
How would i use the find function in splay tree for the following code? I want to be able to see if that node is in the tree, and if it is not, then i would want to be able to return false. here's the link to the splay tree … | |
i've writtn a c++ code, and i like to count the output,i mean 1 --- 2 3 like that, the code is good just the counter, everytime when i run the program i got this kind of error ISO C++ forbids comparison between pointer and integer i really don't know … | |
What I am trying to do is redirect all my cout to a file, rather than a console. I am using a gcc complier to run my program. It works well when I do ./a.out > output.txt. But i was wondering is there a way i can do the same … | |
hi, i want to ask.. is it can to get an input from the user by only call the class object? here's the code : #include <iostream> class Time{ private: int time; int minute; int sec; ... }; void main(){ Time t; cin >> t; cout << "The time is … | |
Hi! I can compile the following code, but when I try to run it with the line [B]a.out File1.txt[/B], my programming partner get a seg fault, and I get this error: [INDENT]a.out: relocation error: a.out: symbol __cxa_allocate_exception, version XXABI_1.3 not defined in file libstdc++.so.6 with link time reference[/INDENT] I found … | |
I am reading a line of text from a file and need to split it into tokens. [QUOTE]This is a test and test number is: test(001)[/QUOTE] I need the tokens to be [QUOTE]This is a test and test number is : test ( 001 )[/QUOTE] How do i split a … | |
i have an assignment to write a program in which conversion of decimal digit into binary, octal and hexadecimal take place using if, switch, do-while, nested-if or nested-if-else statements.... can you help me plzzzz...... i m new comer in i.t and simply have no information about C++ :icon_sad: | |
How can a make a directory in by writing c++ code and transfer files made by me in c++ to that directory | |
Hi! I'm getting this error when compiling: $ g++ index.cpp index.cpp:85: error: 'friend' used outside of class index.cpp: In function 'std::ostream& operator<<(std::ostream&, const GrabStuff&)': index.cpp:88: error: 'myLineNumbers' was not declared in this scope Links to included files: [URL="http://users.cs.fiu.edu/~weiss/dsaa_c++/Code/mystring.h"]mystring.h[/URL] [URL="http://users.cs.fiu.edu/~weiss/dsaa_c++/Code/string.cpp"]string.cpp[/URL] [URL="http://users.cs.fiu.edu/~weiss/dsaa_c++/Code/SplayTree.h"]SplayTree.h[/URL] [URL="http://users.cs.fiu.edu/~weiss/dsaa_c++/Code/QueueAr.h"]QueueAr.h[/URL] And for fun: [URL="http://users.cs.fiu.edu/~weiss/dsaa_c++/Code/SplayTree.cpp"]SplayTree.cpp[/URL] [URL="http://users.cs.fiu.edu/~weiss/dsaa_c++/Code/QueueAr.cpp"]QueueAr.cpp[/URL] [CODE]#include <iostream> #include <fstream> … | |
welcome :icon_smile: I am searching about books (PDF) that talks about Analysis of Algorithms in C++ step by step ........................................... | |
Plz guys i have a problem in my c++ simple calculator, I made everything great but i just need an important hint for my assignment that i can't figure it out. for example when i add two numbers(2+4) the result is (6)... i need the number (6) to be stored … | |
Im trying to write to the list box "Win_1" with SendMessage() but im doing something wrong. Thanks in advance! [CODE] #include <windows.h> #include <tchar.h> #include <string> #include <iostream> #include <richedit.h> #pragma comment(lib,"user32.lib") #pragma comment(lib,"Gdi32.lib") using namespace std; #define IDB_TEXT2 101 #define IDB_TEXT3 102 #define GetF 103 HWND hwnd, Win_1, Win_2, … | |
I previously asked how to install the CC compiler earlier, I decide to share my knowledge of how this compiler instead of g++ I installed this compiler because the CC compiler can handle separate template class files. I hope this is useful to some when looking for a separate C … | |
On windows XP (compiling with visual studio 2008) my calls to open thread result in the following error code: OpenThread() failed: 5 I cant figure out the problem, nor what error code 5 is? Any help is appreciated :) EDIT: Then if i change my OpenThread call to: OpenThread(THREAD_SET_INFORMATION, FALSE, … | |
Hi, Friends plz help me to Convert infix expression to postfix expression using stacks (simple C++ program), I m new to c++ so i don't knw too much abt c++, write a simple program for me, i have just five days more for submitting my assignment, so plz help me, … | |
I cannot figure out what is wrong with this collision detection code. ballx1 and bally1 is the current position for the ball ballx2 and bally2 is the position of the ball one step before paddlex1 and paddley1 is the current position of the paddle diry is the direction of the … | |
The do...while loop works fine when i key in only single character, however if i key in multiple characters, the default statement is executed infinitely. I think the problem lies in cin >> int?, i need some help in modifying the code, thx [CODE] bool rightanswer = true; do { … | |
I am getting 3 error messages: -cannot convert from 'const char [2]' to 'char [10]' 2messages of: 'char secretType::setName(char)' : overloaded member function not found in 'secretType' #include <iostream> #include <cstring> using namespace std; class secretType {private: char name[10]; *error message here int age, weight; double height; public: char setName … | |
[code=cplusplus] #include <iostream> #define MAX 100 int num[MAX]; int n; int nrows = 0; using namespace std; void print() { if (num != 0) { for (int j = 0; j <n; j++) cout << num[j]; cout <<"\n"; } } void leftRotate ( int n) {int tmp; for(int k =1; … | |
These Questions from a pervious exam i need your help to solve it: 1- Write a C++ program that uses a function called calcPay( ) to calculate the total wages of an employee. The total wages are calculated as follows. Total wages= (number of hours worked in a week*hourly pay … | |
Hello Everyone, This program is designed to tell you the probability of winning the Lotto. I am having problem with using the recursive factorial function inside of the function computeWays. I am getting just the numbers of picks for the chance of winning. For example if I enter in 12 … |
The End.