C++ Programming question: It's probably easy, but I can't do it. Can someone help?
95584
I rember doing something like this: you had to take the int you store the input in, and divide it by ten with the mod operator (%), and store it in a new int.  Since the mod operator divides the two numbers, and then returns the remainder, that will separate your last number.  For example:\n\nSay the input is 4321, and you have it stored in int input;\n\nint first_num = input % 10;\n\nthis takes your value in input, divides it by 10, then takes the remainder and stores it in first_num.  In this case, first_num should now equal 1.  \n\nAfter that, you have to shorten your input from 4321 to 432 by dividing (regular dividing this time) it by ten, and storing it in another new int.  (Since int can't have any decimals, dividing by ten just shortens it by the first number).  Then you do the whole thing over until you have all four numbers in separate ints, and then output them to separate lines.  \n\nHope that's clear enough--it's hard to explain this stuff so it's easy to understand.  Good Luck!
704051
Colin, you need to do your own work. And it sounds like you already know you need to shift the elements in the array, so why don't you just write the code?  Draw a picture on paper to see what needs to be done.\n\nIt's important that you develop these problem solving skills on your own. Otherwise, you just won't have any skills to make you worth hiring.
1158232
#include <iostream>\nusing namespace std;\n\nvoid main ()\n{\nint countDown= 0;\n\ncout <<"Enter the number you want to start from: ";\ncin >>countDown;\n\nfor ( countDown; countDown >= 0; countDown--)\n      cout <<countDown<<", ";\n}\n\nAny other question, just ask, eoroxter@gmail.com\nGood Luck,
126096
hallo their.ur prob can be easily solved,i guess.if u know C then its pretty easy.Do u have enough time?if u have i would recommend class 11th n 12th text books(Computer Science With C++) by Sumita Arora n Gautam Sarkar.else u can always go for C++ by Balaguruswamy.this is the authors name.go to any book stall n ask this name.he has written both C n C++ books.i actually dont remember the name of the book.
444754
This sounds like school work, its a fairly simple program. you will probably want to use the cout and cin function which needs you to include iostream.h \n\nsimply use cout to print to screen, ask for input etc. then take the input using cin and store it to a int variable.\n\na good way to do it would be to ask the user what they wish to do, eg subtract, divide and take that operator first, a symbol or a number to show choice. then the next line asks for the numbers to be input.\n\neg:\n\n---------\n\nHello. what do you wish to do:\n1 - subtract\n2 - divide\n3 - etc etc\n\n>\n\n-------------\n\nthen use an if function or maybe a switch to check what their input was and do the artithmatic.\n\nso a very basic prgram may look like this:\nit may have errors i havant checked it.\n\n-----------------\n\n#include <iostream>\n\nint main() \n{\nint number;\n\n    cout << "Hello, input a number" << endl;\n    cin >>number;\n    return 0;\n}\n\n------\n\nEDIT; i re read the req, you might find inputting the selection to a char better, then check the char to see what symbol is stored in it, eg + / -. and maybe use a char array for the number input. simple take the char array, check for the space. split the numbers into 2 and caste then to an int. sounds complicated but it isnt to hard.\n\nsorry about spelling mistakes.
240615
I am giving the solution in C++ using recursion..\n\n!!\n\n#include<iostream.h>\nvoid printstars(int n)\n{\nfor(int k=0;k<n;k++)\n     cout<<"*";\ncout<<endl;\n}\nvoid print1(int n)\n{\nif(n<=1)\n   printstars(n);\nelse\n   printstars(n-2);\n}\nvoid print2(int m,int n)\n{\nif(m==n)\n   cout<<endl;\nelse \n{\n   printstars(m);\n   print2(m+2,n);\n}\n}\n\nmain()\n{\nint n,m=1;\ncout<<"Enter an odd number n";\ncin>>n;\nprint2(m,n);\nprint1(n);\n}\n\nThis produces the output u needed and also uses recursion.
356353
they're both easy and their very similar..\n\nyou don't have to know c to do c++
267921
You can turn these into proper C++ statements:\n\nread a, b\n\nlet max = a\n\nif max < b\n  let max = b\nendif\n\nprint max\n\nThis program assumes that a <> b.
681415
please have a look on this.. \n\n\nhttp://www.cprogramming.com/tutorial/template_specialization.html
557543
#include<iostream>\nusing namespace std;\nint main ()\n\n\n    {\nint number;\nint answer;\n    cout<<"Please enter number: ";\n    cin>>number;\n    \n    cout<<number<<"! = ";\n    answer = number;\n    while (number>1)\n\n\n        {\n        answer=answer*(number-1);\n        number--; \n    } \n\n    cout<<answer; \n    return 0; \n}
869459
void main()\n{\nint n,rev=0,ro,n1;\ncout<<"enter the number";\ncin>>n;\nn1=n;\nwhile(n>0)\n{\nro=n%10;\nrev=rev*10+ro\nn=n/10;\n}\nif ( rev== n1)\n cout<<"the number is palindrom";\nelse\ncout<<"the number is not palindrom";\n}
964471
Hi there you can go to www.cplusplus.com\nOr if you want help ina specific topic just goolgle iT. fOR example\narrays in C++ go to i'm feeling lucky
120342
To really hone your abilities I recommend looking over some of the programming contest problem archives.  They are on the level of a week-long programming assignment in college and teach a variety of different skills: working from problem description to solution, basic data structures, basic algorithms, testing exterme cases...\n\nBeing able to solve problems like these will prepare you for any challenge you will come across :-)\n\nI am also including a few links to C++ resources for you.\n\nGood luck :-)
75512
hey champ(Anirudh) !! what happened... so many errors in ur code?\ni hv'nt done much.. just removed the errors.. \nwell ur code was just like an error removing question... that v used to solve in the boards!  i loved solving those easy pickings!!\n\nanyways.. heres the exact code.. \n\n\n#include<iostream.h>\n#include<conio.h>  //for clrscr() & getch()\n\nvoid main()\n{\nclrscr();         //optional\nint array[10],i,least,greatest;\n\n//Input Numbers\ncout<<" Input 10 numbers separated by spaces  : &#92;n";\nfor(i=0;i<10;++i)\n   {\ncin>>array[i];\n   }\n\ngreatest=least=array[0];\n\nfor(i=1;i<10;++i)\n   {\nif(array[i]>greatest)\n     greatest=array[i];\nif(array[i]<least)\n   least=array[i];\n   }\ncout<<"&#92;nLeast in the list is "<<least;\ncout<<"&#92;nGreatest in the list is "<<greatest;\ngetch();//optional\n}
814965
what c++ program are you referring to ...anyway the syntax is\n\n#include<iostream.h>\n#include<conio.h>\n...include all the header files here ..\n\nint count()\n  {\n     function body\n     return value #integer value to be returned \n\n  }\n\nother functions\n\nvoid main() \n\n   {\n\n# this is the main function \n\nint a,b,c;\nfloat al,bl;\nstring str;\n\n#declare the variables\n\n#get the inputs from the user\ncout<<"enter the value of a ";\ncin>>a;\n...\n...\n\ncall the functions\n\nb=count()\n..\n#do what ever processing has to be done\n } # program closing curly braces\n\n\nhope this helps\n\nthis is a excellent c++ tutorial \n\nhttp://www.geocities.com/sstutor\n\ncprogramming.com is also pretty good
44673
Your program ran into code it couldn't execute or data it couldn't address.\n\nIf you wrote the code, look for things like uninitialized pointers, overwritten data structures, and anything else that could corrupt your code or data.
674903
good answers, but there can also be multiple answers instead of just yes and no.\n\nfor instance, what day is today?\n\nif (day == monday)\n   cout<<"monday";\nelse if (day == tuesday)\n   cout<<"tuesday";\nelse if (day == wedensday)\n   cout<<"wedensday";\n...\nelse \n   cout<<"invalid entry";\n\nof course you could also use a case statement in this example, and would work the same.