581 Posted Topics

Member Avatar for super star 90

You can use something like if [code] if (isalpha(a))//Here 'a' is just a variable in which a character is filled in { cout<<"Invalid"; } [/code] Youshould include the header cctype for this function. It detects if the input is an alphabet and if it is it executes the statement.

Member Avatar for Ancient Dragon
0
72
Member Avatar for edek

What is a pipe which is mentioned above. I dont know much so i get this doubt

Member Avatar for vijayan121
0
261
Member Avatar for Black Magic

I guess you can write your password into a txt file and then access it when ever you want. But the bad part is that anyone else can directly open up the txt file and know what your password is.

Member Avatar for Black Magic
0
77
Member Avatar for Mark515

[QUOTE=Mark515;587966]it doesnt work![/QUOTE] Well mark, niek_e is only giving you an example on how it is done. You can try experimenting in that code to get the answer though. Something like this will work out fine. [CODE]#include <iostream> using namespace std; static const int password=1705898; int main() { int secondnumber; …

Member Avatar for Sky Diploma
0
91
Member Avatar for nurulshidanoni

Till what have you got to? I mean paste in the program that you have worked on until now.

Member Avatar for localp
0
152
Member Avatar for Kaushalya

Try typing 8 instead of 08 [code]case 08:[/code] and replace it by [code]case 8:[/code] That is the only reason it is invalid

Member Avatar for vmanes
0
86
Member Avatar for Black Magic

[QUOTE=Black Magic;586955][CODE=C++]#include <iostream> using namespace std; double FindArea(double& l, double& w); int main() { double width, lenght, area; cout << "How Wide Is Your Yard? : "; cin >> width; cout << endl << "How Long Is Your Yard? : "; cin >> lenght; area = FindArea(width, lenght); cout << …

Member Avatar for Black Magic
0
251
Member Avatar for angleyz14

[QUOTE=niek_e;585947]You need to know about - 2-dimensional arrays - random number generating - user input What do you have so far?[/QUOTE] Yes The two dimensional array can be a pointer pointing to a one dimensional array. So that it will be very easy to allocate. And use a forever loop …

Member Avatar for vmanes
0
80
Member Avatar for only me

What problems do you have in writing the code. Post your code and then we can see. Whats wrong with it.

Member Avatar for Salem
0
101
Member Avatar for mikky05v

Well i have worked out the code. And found that with some small corrections this code is working out. The first mistake is in the declaration in line 6 doesnt match the declaration in line 23 [code]unsigned int romnum (string);[/code] Instead of that you can try using a character . …

Member Avatar for mikky05v
0
138
Member Avatar for Black Magic

You can try to bruteforce it out and just increment by 0.01 maybe that will work out. But the answer wouldnt be exact. So u can try in for an approx val. Then test it up. If the value you got. is squared is lesser than the main number of …

Member Avatar for hammerhead
0
136
Member Avatar for timdog345

[code]for (i=25; 25>=i; i=i-2) { //if (i%2!=0) cout<<i<<" "; } cout<<endl; [/code] if you observe carefully.. You will find the error. this is what you have written: [code]for (i=25; 25>=i; i=i-2)[/code] in the above observe this [code]25>=i;[/code] it should actually show the lower parameter of your problem.

Member Avatar for hammerhead
0
125
Member Avatar for Sky Diploma

Hi all, I am currently working on a program which tests whether 2 numbers multiplied produces a PALINDROME. An example of a palindrome is 16461 which can be read same from both ways hence i devised a test. [CODE=cplusplus]#include <iostream> #include <string> using namespace std; char pali(char orig[100]); int main() …

Member Avatar for Sky Diploma
0
164
Member Avatar for spuddy1515

Hello, I would like to know which Operating System you are actually using. For example if you are using a windows based operating system and the command prompt the command for the clear screen is [CODE]system(cls);[/CODE] Where as for some other operating systems it is [CODE]system(clear);[/CODE] So if you are …

Member Avatar for spuddy1515
0
118
Member Avatar for TheBeast32

You can try taking in a vector char array. That way enough Memory will be allocated depending upon the input .. So you will not need to make such a huge array.

Member Avatar for bugmenot
0
71
Member Avatar for aminit

Hello , I have solved out the code in your program and you can take in the code below. But there are a few backfalls to the program which i was not able to correct because i am still a beginener in programming. they are 1) The keyword should contain …

Member Avatar for Sky Diploma
0
299
Member Avatar for Sky Diploma

Hello Everyone , I am writing a code in which i search a char array and look at what is missing in the array i mean what letters are missing in the array. I worked out a small code but i seem to have some error in the answer though …

Member Avatar for Sky Diploma
0
100
Member Avatar for Trckst3
Re: sort

Hello Trckst3, I have noticed some faults in your program code. 1) Firstly you wont be needing the Libraries [CODE]#include <iomanip> #include <algorithm>[/CODE] In your program. 2) The Bubble Sort Function in your program is faulty. I will give you a small reference(idea) in which you can proceed in, Take …

Member Avatar for Sky Diploma
0
118
Member Avatar for IU34

Well in the code that you have mentioned i dont see the code of the ambulance call . All i just see is other code. There is some other code though. You should paste the code that you have worked out on the compiler so that we can sovle it.

Member Avatar for IU34
0
98
Member Avatar for brianvolkmann

I only got 2 errors with the upper program: 1) the main () cannot be void with my compiler so i put in int main() 2) The function Clrscr(); is invalid. If you wanted to use the clear screen function then you can type cls; instead of it. Thats it …

Member Avatar for Nick Evan
0
153
Member Avatar for Latent12

Hey for the menu's instead of using the If (Conditons ) And testing it to a char . You should try using the Switch operator as it is a cleaner code then the If.. AND else if..

Member Avatar for Majestics
0
227
Member Avatar for gothicmisery85

Absolute value also gets off the decimal places from the number. For eg: abs(3.42) returns 3

Member Avatar for Laiq Ahmed
0
249
Member Avatar for mussa187

Well i would like you to be more clear in the question . Do you want a number that is lesser than 10 Or do not want spaces in between while entering. Because. If there is a space between 2 numbers and you use the command cin>> then it will …

Member Avatar for Ancient Dragon
0
113
Member Avatar for Ice_Dragon

Well this happens to me too. Most of the time. And therefore i use multiple cin.get() codes and also if possible i add another cin statement into the code to view the answer. So try adding the following [code] std::cin >> x; [/code]

Member Avatar for Narue
0
116
Member Avatar for anbuninja

its very easy to remove the percentage out. Lets consider the marks entered as 'x' therefore we need to remove 20% from the marks entered .............. That is 20% of X Let "newX=20% of X" therefore you can use this "newX= (20/100)*X" So we know know X and the marks …

Member Avatar for Sky Diploma
0
113
Member Avatar for daviddoria

You can have namespaces and include some of your functions in a separate namespace. Then use the namespace i guess. If you can make function.h containing the namespace "namespace1" then i think... (This will be the code for that ) #include <function.h> using namespace namespace1; int main(){ function 1(); }

Member Avatar for Narue
0
99
Member Avatar for dolphin.rise

[QUOTE=dolphin.rise;566046]I have a confusion : Is there any specific advantage of using int main() over void main() in c++ programs. Can anybody solve it ?[/QUOTE] Well,I think main() is probarbly Generalised and the computer basically will not expect a specific type from the program. Where as int main () tells …

Member Avatar for mitrmkar
0
273
Member Avatar for 666kennedy

Try the else statement. I dont know but i get the correct answers when i made a few adjustments in the code. [code=cplusplus]cout << "please select which pattern: "; cin >> pattern; if ( pattern == '1' ) { target1 = 1; target2 = 0; } else ( pattern == …

Member Avatar for Narue
0
138
Member Avatar for Ben10

Well you actually forgot to put in some main code. [CODE]#include<iostream> using namespace std; int main() { int NumOfSold,SolValue; float average; cout<<"enter the number of sold items\n"; cin>>NumOfSold; cout<<"enter the sold value for each item\n"; cin>>SolValue; average=SolValue/NumOfSold; cout<<NumOfSold<<":"<<SolValue<<endl; cout<<"average:"<<average; }[/CODE] In your code. "Using namespace std;" was not written And …

Member Avatar for Ben10
0
148
Member Avatar for Moporho

Hello Everyone ., This is my first post in this forum. However to get the prime numbers between 5 to 10000 you can do this First you will need to check whether the number is divisible by 2. [code] bool prime(int x) { If ((x%2)!=0) { if((x%3)!=0) { if ((x%5)!=0) …

Member Avatar for Moporho
0
5K
Member Avatar for Sadaf Masroor

[CODE]for (i=0;i<=n;i++) int no; no=n*ii; } for (i=0;i<=n;i++) cout<<i<<':'<<no<<endl;[/CODE] This is your existing code : Try this one in the place of it [CODE]for (i=0;i<=n;i++) {int no; no=n*i; cout<<i<<':'<<no<<endl; }[/CODE] Hope this works .

Member Avatar for Sky Diploma
0
83

The End.