49,761 Topics
| |
im writing a cd database program, i need to know how i can enter characters in a field which include numbers and letters. neone know what the type is for this. i've tried the following: char album[50]; char s1[50]; none of these work they only allow me to write characters … | |
Hello all, I have posted many times questions about Java related topics. This would probably be one of my few C++ postings. The problem I am having is printing out the contents of a vector declared in a class, and inherited in other classes that need to access it. I … | |
[code]#include<iostream.h> #include<conio.h> int main() { int a[10],temp,bak; cout<<" enter the elements "<<endl; for(int i=0;i<5;i++) cin>>a[i]; int m=a[0]; for(int j=0;j<5;j++) { if(a[j]>a[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } cout<<endl; for(int k=0;k<5;k++) { cout<<a[k]<<endl; } getch(); }[/code] | |
I've recently swithed from borland C++ 5.5 to MinGW. When I try to compile a .c file using gcc it compiles fine, but when I try to compile a .cpp file using gcc it produces a bunch of errors with c++ specific constructs. If I compile .cpp files with g++ … | |
Very simple request, just show me how, in a new windows form application, how I can create and ajust the mount of lets say squares in parent window. Lets say theres a default of 20 squares. But I want to be able to ajust this, in such a way that … | |
I am a novice to C++ but I am trying to improve. Ive started reading quite a few books which include: Learn C++ in 10 minutes - Jesse Liberty C++ Game Programming - Michael Dawson Im still in the first 100 pages in both so im not into to advanced … | |
Very simple request, just show me how, in a new windows form application, how I can create and ajust the mount of lets say squares in parent window. Lets say theres a default of 20 squares. But I want to be able to ajust this, in such a way that … | |
//square matrix #include<iostream.h> #include<conio.h> #include<stdio.h> int main() { void diagsum(int a[10][10],int n); void rowsum (int a[10][10],int n); void colsum (int a[10][10],int n); int a[10][10]; int n,opt; cout<<" enter the size of matrix (say 4 for 4/4etc..) "; cin>>n; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) {cin>>a[j]; } } for(int k =0;k<n;k++) { … | |
i have to convert a program from c++ to C language and at one point in my program im stuck where its dealing with dynamic memory of an array. i started it but i dont know how u do dynamic memomory in c language. [code] if (reply == '1') { … | |
#include<iostream.h> #include<conio.h> int main() { void sortarray(int array[15],int size); void mergearray(int ar1[15], int ar2[15], int ar3[30],int m ,int n); int m, n ,ar1[15],ar2[15],ar3[30],array[15],size; cout<<" Enter the size of the arrays "<<endl; cin>>m>>n; cout<<" Enter the elements of first array "<<endl; for(int i=0;i<m;i++) cin>>ar1; cout<<" Enter the elements of second array … | |
Hi all, I've programmed [B]C[/B] & [B]C++[/B] during my college days. I understood its [I]OO model[/I] and coded many examples (this helped me in OO [I]PHP[/I] now). I used something called [I]Turbo C++[/I], a set of some confusing files, which can be carried in a floppy or two. [QUOTE]I now … | |
Ok i am having alittle problem with my code, I am getting 4 errors for having these things unidetitfied but they are so I dont know what is is here is the code that I have so far. The object is to have counters that will count how many comparisions … | |
Write a program that calculates the average marks of three subjects of a student, entered by the user through keyboard and store them in three different float variables having names marks_subject1, marks_subject2, marks_subject3 The formula to calculate the average is: average = (marks_subject1 + marks_subject2 + marks_subject3) / 3 Your … | |
I have to develop a C++ program that reads the data records from the input file and stores them in a dynamic array of structs, which should be sized just enough for the problem. (TIP: Your program should first scan the input file to determine the number of records to … | |
[code] #include<iostream.h> #include<conio.h> #include<stdio.h> int main() { void palcheck(char str[]); char ans; char str[20]; do { cout<<"Enter the string to check if it is a palindrome. "; gets(str); palcheck(str); cout<<"\nEnter Y to continue. "; cin>>ans; }while (ans=='y'||ans=='Y'); } void palcheck(char str[]) { int l=0,k=0,flag; for(int i=0;str[i]!='\0';i++) l=l+1; k=l; for(int j=0;j<l/2;j++) … | |
Please can someone help me. i don't know where to start. i need to write a programme in c/C++. the features of the programme are stated below: Write a program for Windows XP that makes a countdown timer in your Tray (at the bottom of the screen). When you right … | |
You created a bunch of random numbers, but say you don't want a bunch of random numbers exactly. Say you have ten members of a team and you want to give them a random position represented by 0 to 9. So you create your array and you fill it with … | |
I have a program where I want to point the same ifstream to another file when I am done using it. Currently, I have it set up something like this (pseudocode): //Global File Name char *mmFileName[50] void calculateISI() { ifstream minmaxFS; //sets the global file name if(condition) setGlobalFileName(); while(//assume true) … | |
#include<iostream.h> #include<conio.h> int main() { int a[5],loc,val,ans; do { cout<<" enter the elements "<<endl; for(int i=0;i<5;i++) cin>>a; cout<<" enter the location u want to edit with respect to zero "; cin>>loc; cout<<" enter the val to be inserted "; cin>>val; for(int j=6;j<0;j--) { if(j==loc) a[j]=val; else if(j>loc) a[j]=a[j-1]; } for(int … | |
Hi guys: I am very very new in C++. In school they required me to write a program that reads the names of the students registered for a class and output that result in a file. I got almost everything done. The only problem is with the function getline. I … | |
This program uses an ancient method to find the square root. But the problem is that it only works with certain numbers not all the numbers I input. I would like to know if I am doing anything wrong. I would appreciate any help I could get with this. [code] … | |
hello everyone i was trying to make my own own string concatenation function but wasnt able to do so. i need ur help. | |
I just finished a simple slot machine program. It displays 3 random numbers from 0 - 9 next to each other. I'd like to "soup" it up. Is there some way I can make each of the the numbers spin and stop sequentially. thanks | |
[code] { cout <<" file found ..." << endl; while((ch = infile.get()) !=' ' ) { cout <<"\nRead value is : "<< ch<<endl; cout << "calling function : "; populateArray(ch, i); } } [/code] file contents : if ( a + b ) ; basically its taking the file pointer … | |
Hello there, guys! I am relatively new to programming in C, and I still have a lot to learn. I am currently using Dev C++, but I work in C only. My problem is that I need to fill a 2D table with some multi-character variables, and I don't know … | |
I am trying to output a number of lines, given by the user, of stars shaped as a triangle below: [code] ********* ******* ***** *** *[/code] i have got the following code: [CODE]void line (int n, char c) { for (int i = 1;i <= n; i++) { for (int … | |
when i compile this program [CODE]main() { struct emp { char name[20]; float sal; }; struct emp e[10]; int i; for(i=0; i<=9; i++) scanf("%s %f", e[i].name, &e[i].sal); }[/CODE] it gives the Floating point formats not linked but when i run this [CODE]main() { float x; scanf("%f" , x); }[/CODE]<< moderator … | |
Question: counts how many times the number 5 appears in array called NumArray? Can anybody help me with this problem?? I got 4 "5s" but i don't know if i understood the question correctly or not....does "55" counts as two 5s??? and if it does then how do i count … | |
Can't get this to compile for some reason. Anyone have an idea what's going on with it? [code] #include <iostream.h> #include <stdlib.h> #include <iomanip.h> #include <time.h> void MoveT(int *tortoisePtr, const int End_race); void MoveHare(int *harePtr, const int End_race); void PrintCurrentPosition(const int *snapperPtr, const int *bunnyPtr, const int End_race); int main() … | |
I have created three timers(5sec,5sec, and 10sec) for my Windows gui. When the timer event is triggered, it displays an Timeout error to a textbox. For some reason, the timers doesn't trigger in some procedures but does in others. I don't believe any process is holding up the code to … |
The End.