C++ :: Online Shop - Serious Logical Error
Nov 15, 2013
My project is on an online shop in which you can manage a shop(adding ,deleting ,clearing and modifying items) also you can switch to different shops(all shops are same)
Code:
#include<iostream>
#include<fstream>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
[Code] ....
The logical problem is serious because i am not able to find the error!!! There is some problem with display lines in void shop()-->if(mode=='s') and if(mode=='d'). I add only one item but in output screen i see two items(sometimes >2)
*note* to run the above display lines in the output screen....first register--->add atleast one item--->see your shop
View 12 Replies
ADVERTISEMENT
May 11, 2013
I wrote this code to solve a problem in which the user inputs a permutation of size 'N' and the next permutation of the same elements has to be generated.
I went about this in this way: given 3 2 5 4 1, starting from the right, the first no. has to be searched which has a no. greater to it on its right. Here it is 2. Now an array is generated containing all no.s on its right and greater than it. For 2, it is: 5,4. Out of these the smallest member is searched for and switched with 2. So, 4 is switched with 2 to get the Next Permutation: 3 4 5 2 1.
The code I wrote does not show any error but does not return the correct value when run and gives the same value instead. If I enter '3 2 5 4 1' it returns the same value as the answer.
#include<iostream.h>
#include<conio.h>
void main() {
clrscr();
int N,M,i,n,c,swap,flag,count,small,m;
int Array[100],Key[100];
[Code] .....
View 2 Replies
View Related
Oct 31, 2014
I have to write a program that does the following: Monkey Business A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 - 7 array , where each row represents a different monkey and each column represents a different day of the week. The monkeys are represented by integers 1, 2, and 3; the weekdays are "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". The program should first prompt the user to input the data for each monkey, starting with "Sunday" for monkey #1, then monkeys #2 and #3, followed by "Monday" for monkey #1, then monkeys #2 and #3 and so on, through "Saturday". The program then creates a report that includes the following information, each properly labeled (see below):
-Average amount of food eaten per day by the whole family of monkeys.
-The least amount of food eaten during the week by any one monkey.
-The greatest amount of food eaten during the week by any one monkey.
Input Validation: Do not accept negative numbers for pounds of food eaten. When a negative value is entered, the program outputs "invalid (negative) food quantity -- re-enter" and attempts to reread the value . Prompts And Output Labels: Decimal values should be displayed using default precision, i.e. do not specify precision. Each item read should be prompted for by a string of the form "Enter the food eaten by monkey #N on DAY:" when N is 1 or 2 or 3 and DAY is "Sunday" or "Monday" or ... or "Saturday".
The output should be of the form:
Average food consumed daily: 6.23
The least daily food consumed was by Monkey #0 on Friday
The most daily food consumed was by Monkey #2 on Sunday where the specific amount of food or specific monkeys or specific days identified depend on the actual input.
However after the process of resolving the errors unable to convert to standard string and unresolved externals I now have a logical error that causes the output of the DAYNAME variable to output as what appears to be hex in the following picture:
How I can fix this and why it's casting them as this in the output.
My full code is as follows because I don't know exactly, which line of code is causing this to happen:
Code:
//
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
// constants
const int MONKEYS = 3;
const int DAYS = 7;
[Code] .....
View 5 Replies
View Related
Jul 16, 2013
I've encountered a slight logical error in my code
/*
Lab06_pensionplans.cpp
Purpose :
- Create a simple financial application to calculate retirement plans
*/
#include <iostream>
#include <cstdlib>
using namespace std;
void displayMenu() {
system("cls");
[Code] ....
Look at case 2, which the user supposed to key in a new input, the problem is the value will never got into main function, I don't know what should I modify with the function.
Figured out I need to change the
void changeData(int startingAge, int numOfYears,
double lumpSumAmount, double yearlyAmount, double interestRate )
into
void changeData(int &startingAge, int &numOfYears,
double &lumpSumAmount, double &yearlyAmount, double &interestRate )
View 2 Replies
View Related
Apr 10, 2013
I have to create a small data base for a shop. One of the functions i am creating is taking a customers ID and scanning that through a text file and to print out the info about that customer. What i am having trouble with is where do i insert the string compare in my program?
//declaring array for input of customer ID
int customer_ID [20];
printf("Please enter the customer ID:");
gets( customer_ID ); //users input stored in the array
[Code] .....
View 2 Replies
View Related
Oct 1, 2014
How to use c++ to program network for a multiplayer online game or how would i go about this?
View 5 Replies
View Related
Sep 12, 2014
#include <string>
#include<iostream>
#include<algorithm>
#include<conio.h>
//#include<stdlib.h>
using namespace std;
int check (const char *c,len) {
char ch='a';
if(len%2!=0)
[Code] ....
View 8 Replies
View Related
Jan 26, 2015
This program works on an online compiler but force closes on codeblocks after entering the elements.
#include<iostream>
using namespace std;
int two_print(int x, int one[999]) {
int two[999][999];
for(int k=0, r=x; k<=x; k++, r--)
[code]....
View 6 Replies
View Related
Aug 14, 2014
I have a script that checks and compares two lists from an offline dictionary. Dictionary.txt which has a lot of words in it. input.txt will compare to dictionary.txt and print out anything that matches in CMD.
However, instead of using an offline dictionary is there anyway to make a code check an online dictionary? If so, would this process be slow or fast?
View 8 Replies
View Related
Jan 26, 2014
I want to make an online application which will connect to my database to do the stuff, but I don't want the credentials to be stored somewhere in the program or in an external file somewhere in the computer or hardcored in anyway in the code.
I think that a good solution is (but I don't know how to implement it): on program execution, the credentials will be downloaded from my website somehow in an encrypted type maybe, from an api or so.
I've not tried before to make an online application, it's the first time. But I do have knowledge of SQL and PHP and I want to try a project like this.
The technology I am going to or can use is:
* Visual C# (in Visual Studio 2010 Ultimate)
* MySQL Connector/NET
* MySQL Database on a shared host
* PHP (if needed)
View 10 Replies
View Related
Jan 11, 2013
I am trying to create an on-line product store. I'm having trouble with setting up the code to correctly acknowledge quantity desired per product item in the shopping cart at check-out. I want to be able to capture multiple impressions/hits/clicks per item and increase the # in the quantity box each time someone clicks on the same item. For example, if product A is clicked 3 times, then the quantity in the shopping cart should show "3". If it's clicked 5 times, it should show "5" and so on ... However, right now, it's showing the product multiple times in the shopping cart with a quantity of "1" for each time the item was clicked. How can I correct this?
View 2 Replies
View Related
Feb 10, 2015
I have a desktop application in which i want to copy files from my local computer to an online server. I have the user name and the password of the server. is there any way like
file.copy(sourcePath,destinationPath)
to copy the files where the destinationPath will be something like
"192.168.x.xx/files" ..
View 2 Replies
View Related
Dec 20, 2013
I wrote this program using an online compiler i am getting a lot of errors.
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main() {
string birthmonth;
string birthday;
[Code] ....
View 6 Replies
View Related
Mar 9, 2013
I've received a segmentation fault in this part of code:
Code:
for (; str[i] != '