49,757 Topics

Member Avatar for
Member Avatar for aluhnev

//Hi all,can you explain how to call this function in main. //i ask user to enter the number,like this is it correct in main,recursevely call function? bool isPrime(int n, int d); int main() { int number; cout <<"Enter number >= 1"; cin >> number; if(isPrime(number)) { return cout << "Yes"; …

Member Avatar for aluhnev
0
5K
Member Avatar for bitwiseboredom

So I have this programming assignment I'm doing for my structured programming class (using the C language) that gives me a segmentation fault error. I rewrote the assignment in C++ and it worked fine, but since the class uses C, I must get to the bottom of this and submit …

Member Avatar for bitwiseboredom
0
753
Member Avatar for aluhnev

//Hi,can someone explain the meaning of [size -2],why not [size -1],if we narrowing the string int palindrome(char str[], int size); int main() { cout << "Enter a string: "; char str[20]; cin.getline(str,20,'\n'); cout << "The entered string " << ( (palindrome(str,strlen(str)+1))? "is":"is not" ) << " a Palindrome string." << …

Member Avatar for tinstaafl
0
239
Member Avatar for badmofo

I have an assignment to write a recursive function that takes one integer variable and output the integer in reverse order to the screen. I've tried converting it to a char array(c++ "string" class not allowed) but could not get a counter to work. I can reverse an int array …

Member Avatar for Ali_40
0
875
Member Avatar for rose_2

#include <iostream> #include <conio> void main () { cout<<"rose mary"; getch(); }

Member Avatar for tinstaafl
0
140
Member Avatar for myk45

I have a horizontal layout inside which i have added a group box. The group box is split using a QSplitter and contain a QListWidget and a QTextBrowser. I want to add two push buttons at the bottom right corner of the window to navigate inside the QTextBrowser. I'm adding …

Member Avatar for Banfa
0
449
Member Avatar for Rashmi_1

prog6.h #include "340.h" #include "binTree.h" #ifndef H_PROG6 #define H_PROG6 const vector < int > A{ 1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15 }; const vector < float > B{ 0.5, 1.75, -3, 4.25, 5.50, -6.75, 8, 9.25, -10.5 }; const vector < …

Member Avatar for Banfa
0
345
Member Avatar for bernardo.mclobo

Hi. I'm trying to implement a stack in C++, but i got stuck Here's my code #include<iostream> #include<cassert> #include<cstdlib> using namespace std; template<class Type> class stackTDA { public: virtual void initializeStack() = 0; virtual bool isEmptyStack() = 0; virtual bool isFullStack() = 0; virtual void push(const Type& newItem) = 0; …

Member Avatar for bernardo.mclobo
0
659
Member Avatar for M.Haephrati

Using Visual Studio 2013 C++, I got compilation errors that I couldn't explain. The compilation errors were: *main.cpp(325): error C2601: 'FLAG' : local function definitions are illegal main.cpp(323): this line contains a '{' which has not yet been matched main.cpp(326): fatal error C1075: end of file found before the left …

Member Avatar for mike_2000_17
1
694
Member Avatar for a272

down vote favorite I am currently working as a software developer. I studied science in college and used programming for a science project. However, I was able to obtain my first programming-related job a year ago due to connections. However, I am starting to hate the job (personal reasons, not …

Member Avatar for dternity
0
379
Member Avatar for rayhaneh

I dont know how to writ this program at first: I should write whith "function" which is definition of this function is : fk(n) for e.g-----> 10 ! =3628800 "the lowest non zero degit value" of 10 ! is "8" 12 !=479001600 "the lowest non zero degit value" of 12 …

Member Avatar for rayhaneh
0
178
Member Avatar for Lilgenski16

//Mad lib // Creates a story based upon user input #include <cstdlib> #include <iostream> #include <string> using namespace std; string askText(string prompt); int askNumber(string prompt); void tellStory(string name, string noun, int number, string bodyPart,string verb); int main() { cout << "Welcome to Mad Lib.\n\n"; cout << "Awnser the following questions …

Member Avatar for Lilgenski16
0
436
Member Avatar for shahera.arafat

hii :) I've seen alot in (void)func. that at the end of it they put (return;) why they put it ??what is the logical meaning of it ?? is it the same as (return0;) ?? actually it confused me alot :/ thanks ^_^

Member Avatar for mike_2000_17
0
190
Member Avatar for Web Spider

Hi there, I am working on signature based IDS, for this I have captured the TCP/IP traffic through Wireshark and got a pcap file, I want to extract some fields from the packet itself. How do I do this? I have been searching through the Internet and got the idea …

Member Avatar for L7Sqr
0
135
Member Avatar for Learner010

As usual, after learning new stuff, I write on it. Yesterday I finished learning on "Functions in C++" and found that functions are very easy to learn and useful. Hope this tutorial helps beginners. # What is function? # Sometimes when we want to execute a specific task wherever it's …

Member Avatar for Learner010
2
867
Member Avatar for fardous
Member Avatar for nitin1

I am using Eclipse and there is one strange error coming while building. In files, it is not showing any error but when I build it, it says **Description Resource Path Location Type Program "g++ -std=c++0x" not found in PATH test [Discovery Options] page in project properties C/C++ Problem ** …

Member Avatar for rayhaneh
0
110
Member Avatar for rayhaneh

hi ! I want to sum of digts on C++ but when get the nagative number give me the result if pastive number like when u write -98 answer u 17 not -17 #include<iostream> #include<math.h> using namespace std; int main(){ int N=0 ; cin>>N; int sum=0; while(N!=0){ sum += (N%10); …

Member Avatar for Lerner
0
177
Member Avatar for parvezshahjada

Input: String of expression A21 (+-) BB6C Output: 1) String T (+-)T 2) file 000 | 121 001 | BB6C write the program with C++

Member Avatar for NathanOliver
0
59
Member Avatar for HuePig

Hi, I have a Blackboard class and an Item class: void Blackboard::send(std::vector<std::string> msg, std::string to){ std::list<Subscriber*>::iterator p; for (p = subscribers.begin(); p != subscribers.end(); p++) { if ((*p)->getName() == to) //check if sender is subscribed { (*p)->update(msg); } else{ // reciever is not subscribed std::cout << "Can not find " …

Member Avatar for HuePig
0
128
Member Avatar for kareem.keko.35

hello . i have a task to make a program working by FIFO logic , i wanna help with it , i have to ask user to enter number of Slot then number of programs , then start add numbers i thinking a lot and used a lot of loops …

Member Avatar for ddanbe
0
78
Member Avatar for aulia.septadinarty

1>e:\aulia septa dinarti228\modul 1\final project uts\final project uts\final project uts.cpp(41): warning C4091: 'typedef ' : ignored on left of 'pasien::pasien' when no variable is declared. what is mean in error project ?

Member Avatar for Moschops
0
43
Member Avatar for gothv

Hey guys, So I have this atm machine assignment. Everything is working great, except I don't know how to declare char. I want to be able to choose between a, b, c & d. I am still a beginner we only covered 1 chapter so far in class so I'm …

Member Avatar for gothv
0
230
Member Avatar for Pyler

when compiling code from my main function ireceive the following error `error: conversion from 'rectangle*' to non0scalar type 'rectangle' requested` My code is quite simple; Here's my main function #include <iostream> #inclde "rectangle.h" using namespace std; int main() { rectangle rect = new rectangle(3,4); cout<<rect.area()<<endl; cout<<rect.perimeter()<<endl; return 0; } here's …

Member Avatar for Moschops
0
172
Member Avatar for wan_1

this is the question given by my lecturer :- Write a program to accept 5 students (names) and their respective test marks into an array or arrays. Sort them and print the lists in: a) alphabetical order b) mark ranks(from highest to lowest) and my input is enter name : …

Member Avatar for taichichuan
0
146
Member Avatar for Builder_1

Write a function ListSplit that will split a circular list containing an even number of nodes, say 2k, into two circular lists each of which contains k nodes. The function should have three parameters and should work so that the function call ListSplit(list,sub1,sub2); will create new lists pointed to by …

Member Avatar for Builder_1
0
422
Member Avatar for maskinao

Hi! I'm trying to write a code for my arduino project. it's an SMS-based Led matrix display. I seem to have problems with SRAM memory because of the size of the code. can you help me optimize it? #include "cmap.h" #include <SIM900.h> #include <sms.h> #include <SoftwareSerial.h> #define INTEN 6500 //speed …

Member Avatar for jamescasundo
0
354
Member Avatar for meeno28_

May someone help me.. A kilogram is 1000 grams. Write a program that will read the weight of a package oof butter and output the weight in kilograms, as well as the number of package of butter needed to yield 1 kilogram of butter. Your program should allow the user …

Member Avatar for Slavi
0
141
Member Avatar for Bharath_4

Let x be a node in SLL. Write a C++ function to delete the data in this node. Following this deletion, the number of nodes in the list is one less than before the deletion. Your function must run for O(1).

Member Avatar for happygeek
0
263
Member Avatar for faultybits

The father of C++, Bjarne Stroustrup took part in a live Q&A via Google Hangout-On-Air. The Q & A was moderated by Patrick S, one of the moderators from the C++ Google+ Community, and Brad Y., of Pearson Ed/InformIT. The Q&A session was a public event. PS:This is not your …

Member Avatar for HiHe
0
210

The End.