-
Began Watching Structures
Could some one help me out with the basics of Structures ? How to use them in C programs ? etc.. Thanx in advance. -
Replied To a Post in Structures
Here is a demo of sorting an array of struct (the array holds a 'Contact list'.) typedef struct Contacts { char name[16]; int area; int phone; } Contacts; Here is … -
Began Watching syntax analyzer
i asked this on the C++ forum but someone told me to try it here on C. here's my first program there are some error with this program, i can't … -
Replied To a Post in syntax analyzer
There are numerous problems with your code. 1. Do not use conio.h if you want portable code. 2. Avoid the dangerous use of gets ... use fgets instead. 3. ... … -
Began Watching calculating sum of series of cubed numbers
#include<stdio.h> #include<math.h> int main() { int n,nstart,nstop,nstep,i,j,zNumber; ` printf("Please enter a value of a positive integer nstart: "); scanf("%d",&nstart); printf("Please enter a value of a positive integer nstop: "); scanf("%d",&nstop); … -
Replied To a Post in calculating sum of series of cubed numbers
A first step to coding a solution to any problem is a clear understanding (and statement) of the problem. What is the expected input (validate input to make sure ok.) … -
Began Watching if/else statement
• my assignment is to find the commission of each monthly sales,how can i get the right answer? monthly sales is 0-19,999(4%)/ 20,000-29,999(5%) /30,000-39,999(6%) / 40,000-49,999(7%) 50,000-above(9%) using if/else statement … -
Replied To a Post in if/else statement
Where is your 'int main()' function ? Every C or C++ program needs one. #include <iostream> // use < > brackets using namespace std; int main() { // your code … -
Replied To a Post in String comparison (string manipulation) and sorting, need help
You could use the above example (copied now here below): char takeInChar( const string& msg ) { cout << msg << flush; string reply; getline( cin, reply ); if( reply.size() … -
Began Watching Vectors/Classes Program, Need Help
Hi, guys, I need some help to figure out how to get my program working. Program description: The purpose of this program is to all the user to input names … -
Replied To a Post in Vectors/Classes Program, Need Help
Your coding work can be made *SO MUCH easier* ... if you JUST use a vector to hold the cites ... in the main program. (Then you can use the … -
Replied To a Post in String comparison (string manipulation) and sorting, need help
Yes ... but here, you seem to NOT want (or need) any code to handle file input ... since you are getting input from the keyboard to fill up a … -
Began Watching syntax analyzer
program 1. create a program that accepts strings and syntactically analyze it whether it belongs to the language defined by the BNF below: BNF: <VD>-><DT><VL>; <DT>->char|float|int|double <VL>-><V>|<V>,<VL> <V>->'any valid variable … -
Replied To a Post in syntax analyzer
You seem to be coding in C here in the C++ coding forum. This may be better handled in the C coding area? Not good to use conio.h stuff Shun … -
Replied To a Post in String comparison (string manipulation) and sorting, need help
Also ... it would be best to accept ONLY valid input from the user ... (if you are NOT using input from a valid data file) ... You could do … -
Replied To a Post in String comparison (string manipulation) and sorting, need help
Since you are using C++ ... Why not just easily USE C++ string ... Then ... your program to input strings into a vector of strings ... and to sort … -
Began Watching Conversion from any base to base 10
Ok so I try to do it this program by myself and I can't do it mysfelf. Im a new to this programming stuff. So I came here to ask … -
Replied To a Post in Conversion from any base to base 10
Would you like to show us the program you have ... -
Replied To a Post in String comparison (string manipulation) and sorting, need help
What do you want to have in your main function ... Maybe ... something like this: int main() { VecStr vs; // construct empty vector ... loadFromUser( vs ); cout … -
Began Watching What's wrong with my code?
After I enter first name then program fail. Error: RUN FAILED (exit value 1, total time: 2s). I use Netbeans #include <iostream> using namespace std; struct Student { char * … -
Replied To a Post in What's wrong with my code?
Since your are using C++, why not rather use C++ strings? // structStudent.cpp // // 2014-02-25 // #include <iostream> #include <string> using namespace std; struct Student { private: string firstName; … -
Began Watching Pointers
Having trouble understanding pointers . Could anyone please help me out ? thanx in advance. -
Replied To a Post in Pointers
If you remember that pointer variables hold addresses, you will be well on your way. Just remember to 'dereference' that pointer, when you wish access the value at 'that address' … -
Stopped Watching Starting " C "
EDIT: Please note, as I write this, the post is now 6 years old and might have some outdated information. I'd personally recommend beginners start with "Learn C the hard … -
Began Watching computer architechture
Design a C program that will convert temperature values from degrees Celsius to degrees Fahrenheit. The user must enter a start and a finish value, together with a step value. … -
Replied To a Post in computer architechture
To get you started ... pseudocode/comments could look something like the following ... #include <stdio.h> int main() { // declare variables // input with prompt to user, the lower starting … -
Began Watching Permutation of string
i have a c code for printing all permutation of string. I have a problem in understanding ,how recursion work in for loop and how backtracking is used in this … -
Replied To a Post in Permutation of string
This modified code example may help you to see what is being done as the program executes ... /* permutationsOfString.c */ /* 2014-02-25 */ /* I have an example, coded … -
Began Watching how to read file in c++
give me coding for search and edit a file in c++ -
Replied To a Post in how to read file in c++
> give me coding for search and edit a file in c++ Can you supply an example of the types of files you wish to search ... and the types … -
Replied To a Post in Text Analysis
You may like to see this example ... that uses 'real words' found in some dictionary // twoWords_dictionaryLookUp.cpp // // 2014-02-25 // // program to be able to take in … -
Began Watching Text Analysis
//my program should be able to collect two words and compare them outputing the words from word1 which are also in word2 and outputing them and viceversa. my problem is … -
Replied To a Post in Text Analysis
string spc( 3, ' ' ); cout << '*' << spc << '*'; Is short code ... But ... what is a 'word' ? Does it need to be a … -
Replied To a Post in String comparison (string manipulation) and sorting, need help
These may help ... (edit out the file stuff, also, of course.) typedef vector< string > VecStr; char takeInChar( const string& msg ) { cout << msg << flush; string … -
Replied To a Post in String comparison (string manipulation) and sorting, need help
My output, for the test file above, as input, was: (matches your request ...yes?) Before sorting ... 1 10 2 9 a1 b10 a10 a2 a9 b1 b2 After sorting … -
Replied To a Post in String comparison (string manipulation) and sorting, need help
Try it with this small test 'text file', and name the file to match the file name used in the program ... "alphaNum.txt" It is easy (easier sometimes) to test … -
Began Watching String comparison (string manipulation) and sorting, need help
Hi, I need some help with sorting my string comparison. Bascially what I have to do is this: To have numbers sorted properly even when they aren't justified with leading … -
Replied To a Post in String comparison (string manipulation) and sorting, need help
If your input data is close to what you show above ... something like the following could do ... /* sortAlphaNum.cpp */ /* 2020-02-24 */ /* Here is what I …
The End.